Commit graph

679 commits

Author SHA1 Message Date
Christopher Willis-Ford
b4c0cfe940 Refactor common code in {central,worker}-dispatch
Central dispatch and worker dispatch share most of their code now by
inheriting from a new shared dispatch class.

Also, the format of passed messages has been altered to make it easier
to understand in a debugger.
2017-08-09 17:30:00 -04:00
Christopher Willis-Ford
97d67d75f4 Allow 'then' on service registration
This allows a service to postpone communication with other services
until it can be sure that it's registered with central dispatch. Service
registration on the main thread always happens immediately, but that
version of `setService` still returns a Promise for consistency.
2017-07-21 13:23:52 -07:00
Christopher Willis-Ford
0fcc248ac1 Add tests for message dispatch system; fix bugs
The tests run using TinyWorker, which emulates web workers on Node.
There are quite a few quirks in that situation due to the differences
between Node and Webpack as well as the differences between TinyWorker
and real Web Workers.

The tests also exposed a few bugs in the dispatch system, which have now
been fixed. Most notably, if a method called through the dispatch system
throws an exception that exception will now be passed back to the
caller. Previously the exception would escape the dispatch system and
the caller would never hear any response at all.
2017-07-21 13:23:52 -07:00
Christopher Willis-Ford
09d3fe330f Implement message dispatch system
This message dispatch system allows a "service" to register itself under
a particular name, and then anyone can call any method on that service
from any context (the main "window" thread or any worker). Return values
are passed back through promise resolution.
2017-07-21 13:22:14 -07:00
Paul Kaplan
bd3a29650b Fix variable import scoping 2017-07-17 12:28:44 -04:00
DD Liu
912e7daa81 Merge pull request #636 from fsih/deleteMonitors
Update monitors when deleting or renaming variables
2017-07-17 11:06:29 -04:00
Paul Kaplan
0e33d061fe Merge pull request #633 from paulkaplan/fix-sound-indexing
Fix sound indexing and add tests
2017-07-13 15:08:05 -04:00
Paul Kaplan
eb04fcab57 Merge pull request #634 from paulkaplan/sound-costume-renaming
Add public API for costume and sound renaming
2017-07-13 09:00:19 -04:00
DD Liu
01db5da8ce fix value 2017-07-11 13:08:18 -04:00
DD Liu
4b1307bb11 fix test 2017-07-11 11:51:47 -04:00
DD Liu
7f1f9079e3 support rename variable 2017-07-10 18:29:25 -04:00
Paul Kaplan
a83c0808a0 Add public API for costume and sound renaming with tests 2017-07-07 08:19:32 -04:00
Paul Kaplan
2ddb6215fd Add tests and fixes for set instrument and play drum 2017-07-06 14:56:46 -04:00
Paul Kaplan
1b6baf8114 Make playSound use one indexing 2017-07-06 14:28:11 -04:00
Paul Kaplan
6fa49b1e7a Merge pull request #629 from marisaleung/develop
ChangeBlock uses id's of variable instead of name.
2017-06-30 08:10:55 -04:00
Chris Willis-Ford
47fc38fd9a Merge pull request #619 from cwillisf/clone-custom-state
Clone custom state
2017-06-27 22:37:30 -07:00
marisaleung
22f87e32f8 ChangeBlock uses id's of variable instead of name. 2017-06-27 16:28:37 -07:00
Paul Kaplan
b0fb4f0b55 Merge pull request #614 from marisaleung/develop_cherry-picks
Updated variables and var_fire event listener.
2017-06-23 13:05:03 -04:00
marisaleung
875ccf5b88 Updated variables and var_fire event listener. 2017-06-23 09:57:01 -07:00
Eric Rosenbaum
01f801a2a2 Remove all audio effects except pitch and pan 2017-06-19 14:56:29 -04:00
Christopher Willis-Ford
06d5994a32 Use targetWasCreated event to clone pen state
Remove explicit cloning of `_customState` in favor of smarter,
state-specific cloning.
2017-06-16 14:22:51 -07:00
Christopher Willis-Ford
04871e24d6 Move RenderedTarget.runtime into Target
Some code in `Target` was already assuming a `runtime` property was
available, so this change just makes it official.
2017-06-16 13:16:13 -07:00
DD Liu
2fb502fb70 add ability to refresh workspace for current editing target 2017-06-15 11:53:30 -04:00
Paul Kaplan
93bac9ad85 Merge pull request #608 from paulkaplan/unshadow-variable-dropdown
Use variable field instead of input shadow
2017-06-15 10:02:08 -04:00
Paul Kaplan
5df4456c4a Use variable field directly 2017-06-14 16:31:29 -04:00
Christopher Willis-Ford
884ba19aab Add support for older SB3 JSON
If the `dataFormat` field is absent, fall back on the older `assetType`
field. That can at least help us tell if something is a vector or bitmap
image, though it doesn't tell us which kind of bitmap.
2017-06-13 14:56:06 -07:00
Christopher Willis-Ford
88e44c65eb Remember the data format when an asset is imported 2017-06-12 12:31:49 -07:00
Ray Schamp
d9704b23c3 Merge pull request #598 from cwillisf/improve-clone-cleanup
Improve cleanup on clone disposal
2017-06-12 09:45:07 -04:00
Paul Kaplan
f968edec54 Merge pull request #594 from paulkaplan/select-other-sprites-after-delete
Select the last target instead of the first after deleting
2017-06-12 08:41:20 -04:00
Paul Kaplan
9c5d43e9d3 Enhance sprite delete behavior 2017-06-12 08:35:27 -04:00
DD Liu
fb986effe6 Merge pull request #593 from fsih/fixWaitCalledEveryFrame
Change wait to use a promise instead of being called every frame
2017-06-08 15:35:48 -04:00
Christopher Willis-Ford
454082b569 Improve cleanup on clone disposal
The `dispose()` method on `RenderedTarget` now:
- informs the runtime that it should end any threads corresponding the
  target being disposed, and
- removes the clone from its sprite.
2017-06-07 17:05:24 -07:00
Chris Willis-Ford
d41997b58b Merge pull request #556 from cwillisf/wedo2-blocks
Add WeDo 2.0 blocks
2017-06-07 09:57:36 -07:00
Paul Kaplan
40345384aa Select the last target instead of the first 2017-06-07 09:06:46 -04:00
DD Liu
e237d24846 fix lint 2017-06-06 10:21:27 -04:00
DD Liu
ab0cef52eb Change wait to use a promise instead of being called every frame 2017-06-05 16:55:15 -04:00
Ray Schamp
ecf535f4c3 Merge pull request #579 from cwillisf/load-jpeg-backdrops
Specify dataFormat when loading asset for import
2017-06-02 09:06:37 -04:00
Ray Schamp
adcd225598 Merge pull request #584 from rschamp/nit/no-useless-call
Fix no-useless-call todo
2017-06-01 09:48:58 -04:00
DD Liu
d3d82bae69 Merge pull request #574 from fsih/immutableState
Only send update monitor events when changes happen
2017-05-30 12:38:09 -04:00
Ray Schamp
b810b7be0a Merge pull request #583 from rschamp/bugfix/save-clones-bad
Don't serialize clones when saving
2017-05-30 10:24:52 -04:00
DD Liu
55f677702a add missing file 2017-05-30 10:05:13 -04:00
Paul Kaplan
51928bac65 Merge pull request #581 from paulkaplan/feature/variable-persistence
Add variable creation and variable serialization
2017-05-30 09:26:37 -04:00
DD Liu
809760b954 Merge branch 'develop' into immutableState 2017-05-26 13:50:50 -04:00
Paul Kaplan
3e9dfde43f Merge pull request #576 from paulkaplan/feature/monitor-labels
Send monitor opcode and block params instead of fixed label/categories
2017-05-26 11:07:58 -04:00
Paul Kaplan
77cc01a38a Add variable creation and variable serialization 2017-05-25 11:44:49 -04:00
Christopher Willis-Ford
cbfbc5d600 Convert motor duration: seconds -> milliseconds
The block takes seconds, whereas the device takes milliseconds. Turning
on a motor for 1 millisecond isn't very dramatic.
2017-05-24 16:40:55 -07:00
Christopher Willis-Ford
06fe701624 Implement WeDo 2.0 blocks 2017-05-24 16:40:55 -07:00
Christopher Willis-Ford
2625529ebe Create WeDo 2.0 device communication classes 2017-05-24 16:40:55 -07:00
Christopher Willis-Ford
eb931fd99b Specify dataFormat when loading asset for import
When importing a project we know the file extension for each asset to be
loaded. This change provides that information to the storage system so
that we can load assets which don't use the default. For example, this
allows loading JPG-format backdrops.

In support of this change, there's a new function on `StringUtil` called
`splitFirst`, which splits a string on the first instance of a separator
character. This change includes unit tests for this new function.
2017-05-24 15:35:10 -07:00
Chris Willis-Ford
3970883e45 Merge pull request #549 from cwillisf/device-manager-client
Device manager client
2017-05-24 14:43:28 -07:00