Michael "Z" Goddard
882a83db9a
do not evaluate text-encoding until it is needed
...
text-encoding has about ~700KB of data that is great to skip decoding
for systems that have a browser provided TextDecoder.
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
bc5605cf80
lazy evaluate project loading related code
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
146e93e4ec
start loading sb2 sounds before handling sb2 data
2019-02-15 17:43:55 -05:00
Karishma Chadha
59f58b0284
Merge pull request #1933 from ErikMejerHansen/feature/field_type_support
...
Feature/field type support
2019-02-12 09:59:22 -05:00
Paul Kaplan
6deab79903
Merge pull request #1979 from paulkaplan/share-blocks-new-ids
...
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-07 08:31:25 -05:00
Paul Kaplan
31fbcfa4d7
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-06 10:16:22 -05:00
Karishma Chadha
13e69bad7b
Code cleanup -- move out duplicate .then
statements after the next .then
(at the higher level)
2019-01-30 16:45:38 -05:00
Karishma Chadha
dfcd09fedc
Stop emitting project changes within 'runtime._step()'. Emit project changes in scenarios that were previously taking advantage of runtime._step()
2019-01-30 10:59:25 -05:00
Karishma Chadha
a9cf509a55
Merge pull request #1941 from kchadha/add-runtime-to-blocks
...
Add reference for `runtime` to blocks container
2019-01-30 10:57:45 -05:00
Karishma Chadha
0bf5d8ab90
Update VM getPlaygroundData function to remove circular dependency in blockContainer. It wasn't being used by the tests or the playground and it is not an issue with actual project serialization. Update test to stop passing in runtime to blocklyListen function.
2019-01-24 15:26:16 -05:00
Karishma Chadha
e5723e299a
Add runtime to blocks container since it was getting passed in everywhere where it was being referenced. Update calls to blocks constructor.
2019-01-23 18:18:38 -05:00
Erik Mejer Hansen
ceaa3c7857
Add support extensions to define custom field types.
...
This is done by adding a new element "customFieldTypes" to the extension info structure. Ex:
```
customFieldTypes: {
angleField: {
implementation: { fromJson: options => new AngleField(options) },
output: 'number',
outputShape: 2,
}
}
```
Field types are defined by an implementation that has to match what is expected by ScratchBlocks.Field.register and its output and shape.
src/engine/runtime.js has been updated to handle the new "customFieldTypes"-field:
- Existing (global) field types cannot be overridden
- New fields are "namespaced" to the extension in the same way as opcodes are.
Once the custom field type has been picked up by scratch-vm a "EXTENSION_FIELD_ADDED" event is emitted.
It is then up to the hosting app to call ScratchBlocks.Field.register to register the field type with ScratchBlocks. Ex:
```
vm.addListener('EXTENSION_FIELD_ADDED', fieldInfo => {
this.ScratchBlocks.Field.register(fieldInfo.name, fieldInfo.implementation);
});
```
2019-01-20 21:24:32 +01:00
Evelyn Eastmond
7831256044
Change event names to be more descriptive. Fix some typos.
2019-01-16 20:17:19 -05:00
Evelyn Eastmond
156b1bc21a
Adding new runtime event for intentional peripheral disconnects.
2019-01-16 15:22:58 -05:00
Karishma Chadha
59a865ef47
Create a new addTarget
function on the runtime which populates the targets list as well as the executable targets list.
2019-01-14 11:48:11 -05:00
Karishma Chadha
fbee37e915
Populate executable targets when runtime.targets is populated so that scripts don't run before they are supposed to (e.g. before targets are done getting installed).
2019-01-11 14:52:34 -05:00
Karishma Chadha
4ad101f5d4
Apply suggestions from code review
...
Co-Authored-By: mzgoddard <mzgoddard@gmail.com>
2018-12-20 14:12:33 -05:00
Karishma Chadha
f1a24e3296
Update src/virtual-machine.js
...
Co-Authored-By: mzgoddard <mzgoddard@gmail.com>
2018-12-20 14:11:58 -05:00
Michael "Z" Goddard
5593b28984
try handling as a Scratch 1 file after scratch-parser validation fails
2018-12-20 13:55:49 -05:00
Michael "Z" Goddard
a92f33960f
fix: use ValidationError to determine if an SB1File error should throw
2018-12-20 13:32:30 -05:00
Michael "Z" Goddard
f43163fc73
depend on scratch-sb1-converter and convert sb1 files to sb2
2018-12-20 12:09:58 -05:00
DD Liu
fe375fa672
Merge pull request #1849 from fsih/addCostumeFromLibrary
...
Add addCostumeFromLibrary
2018-12-18 12:12:18 -05:00
DD
a4744f5ac9
Add addCostumeFromLibrary
2018-12-14 14:20:42 -05:00
picklesrus
ebe06a97d9
Merge pull request #1818 from picklesrus/monitor-vars-project-load
...
Clear out the blocks in dispose. Fixes #1758 where old monitored vari…
2018-12-07 15:08:09 -05:00
picklesrus
3f3c34b43a
Given the bug found with the old approach, fix this by going and deleting all of the monitor blocks for each sprite and the global variables.
2018-12-06 18:59:58 -05:00
Paul Kaplan
8405ff00d4
Merge pull request #1825 from paulkaplan/emit-start-publicly
...
Emit PROJECT_START event publicly on green flag click.
2018-12-06 15:38:05 -05:00
Paul Kaplan
56c062eee3
re-emit the PROJECT_START event publicly, add unit test
2018-12-06 11:47:09 -05:00
Karishma Chadha
dc4fd15197
Make a cloud device requestVariableUpdate when setting a variable through the vm's top level setVariableValue API. Add unit test for new functionality.
2018-12-05 22:38:06 -05:00
Paul Kaplan
7e96ef2985
Serialize Infinity and NaN to 0
2018-12-04 10:52:49 -05:00
Karishma Chadha
ff2566fec4
Merge pull request #1778 from kchadha/emit-cloud-data-update
...
Emit cloud data update
2018-11-28 17:23:29 -05:00
Karishma Chadha
86d61a4c20
Emit event tracking when the project's hasCloudData status changes. Cloud var creation now happens regardless of connectivity to the provider.
2018-11-28 15:03:19 -05:00
picklesrus
f214d3a191
VM changes for the sensing_of block. This handles lists properly (by ignoring them like Scratch2 and makes the attribute menu update based on what was chosen in the target menu.
2018-11-28 10:35:35 -05:00
Chris Willis-Ford
05979e2e93
Merge pull request #1784 from cwillisf/setLocale-always-refreshBlocks
...
Make setLocale consistently refresh blocks
2018-11-27 19:19:41 -08:00
Paul Kaplan
ffb02c607d
Merge pull request #1783 from paulkaplan/emit-start-event
...
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 16:38:27 -05:00
Christopher Willis-Ford
4256f86ac3
Make setLocale consistently refresh blocks
...
This change makes the VM's `setLocale` method call `refreshBlocks` even
when not changing the language, though it still skips an unnecessary
call to `formatMessage.setup` in this case.
2018-11-27 10:26:04 -08:00
Paul Kaplan
cc4751228e
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 11:37:01 -05:00
Ray Schamp
5022227c15
Add "project changed" event
...
And emit it whenever we think the project has changed. Try to not emit it when a change has happened internally that shouldn't affect the serialized project.
This iteration fires the event too frequently, e.g., when switching sprites. This is meant as a simple initial implementation that can be improved.
2018-11-26 17:10:43 -05:00
Ray Schamp
f2550d582c
Merge pull request #1750 from rschamp/feature/sb3-json-assets
...
Add method for collecting all targets' assets
2018-11-15 10:31:58 +00:00
Ray Schamp
bcd1c5b13a
Consolidate collectAssets into getter
2018-11-15 10:26:05 +00:00
Ray Schamp
df56e615ec
Add method for collecting all targets' assets
...
Resolves #1601 . Does not include the project JSON since that would require knowledge of a project ID, which the VM has not been responsible for so far.
For now, it is the responsibility of the consumer to determine if these assets should be saved or not. Otherwise the VM would need to be responsible for saving, which has been out of its scope.
2018-11-12 15:13:02 +00:00
Paul Kaplan
c8ad1955d4
Load extensions before sharing blocks.
...
This commit fixes the unit tests so the assertions are made after the promise resolves
2018-11-05 13:00:35 -05:00
Paul Kaplan
596d0c4f5f
Include the origin blockId of the top block being dragged.
...
This is required by the GUI in order to take a snapshot of the blocks for the backpack. Only the ID is needed, the rest can be done by the GUI.
2018-11-01 14:13:07 -04:00
Katie Broida
6ef600dc2c
Add runtime event for when the project is loaded ( #1669 )
2018-10-30 15:26:22 -04:00
Karishma Chadha
aa200e6df3
Set the cloud provider and request updates to the cloud var when updating the variable through blocks.
2018-10-29 00:59:06 -04:00
Ray Schamp
b47912dce4
Store asset objects on costumes and sounds
...
Stop using storage for in-memory storage, and keep these on the vm objects. Towards https://github.com/LLK/scratch-vm/issues/1577
2018-10-23 11:10:50 +01:00
Evelyn Eastmond
2564b24d71
Differentiate peripheral errors: request vs. disconnect ( #1654 )
...
* Beginning to add differentiation for hardware disconnect alerts.
* Set connected status after error is sent.
2018-10-17 15:48:07 -04:00
Evelyn Eastmond
ad3328197e
Testing adding message/extensionId passing into specific, custom alerts.
2018-09-22 14:04:37 -04:00
Evelyn Eastmond
96327c66f3
Passing custom alert messages with PERIPHERAL_ERROR.
2018-09-22 14:04:37 -04:00
Ray Schamp
e2c6c7667b
Merge pull request #1604 from ericrosenbaum/feature/listening-indicator
...
Add event to show and hide a mic indicator for Speech to Text
2018-09-21 09:24:59 -04:00
Eric Rosenbaum
e2a79ed58f
VM emits MIC_LISTENING
2018-09-20 17:13:51 -04:00