Also run monitor blocks every frame

This commit is contained in:
DD Liu 2017-07-28 14:38:26 -04:00
parent 2aef75bc11
commit cc1678fa9e

View file

@ -478,7 +478,8 @@ class Runtime extends EventEmitter {
}, opts); }, opts);
// Remove any existing thread. // Remove any existing thread.
for (let i = 0; i < this.threads.length; i++) { for (let i = 0; i < this.threads.length; i++) {
if (this.threads[i].topBlock === topBlockId) { // Toggling a script that's already running turns it off
if (this.threads[i].topBlock === topBlockId && this.threads[i].status !== Thread.STATUS_DONE) {
const blockContainer = opts.target.blocks; const blockContainer = opts.target.blocks;
const opcode = blockContainer.getOpcode(blockContainer.getBlock(topBlockId)); const opcode = blockContainer.getOpcode(blockContainer.getBlock(topBlockId));
@ -487,7 +488,6 @@ class Runtime extends EventEmitter {
// edge activated hat thread that runs every frame // edge activated hat thread that runs every frame
continue; continue;
} }
this._removeThread(this.threads[i]); this._removeThread(this.threads[i]);
return; return;
} }