Open
Description
Right now, fireTrigger
and Trigger.start
return Promise
s. broadcastAndWait
works by waiting for the Promise
returned by fireTrigger
to resolve, and yield
ing until then.
Async code has some really convoluted timing details, so it may be worth changing fireTrigger
to return a generator function which waits until all started threads are done (or to just return the list of all started threads, and let broadcastAndWait
do the waiting itself).
This may also be necessary to get some of Scratch's timing details correct (see also scratchfoundation/scratch-vm#1683).