diff options
| author | jmoenig <jens@moenig.org> | 2014-11-20 14:40:13 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2014-11-20 14:40:13 +0100 |
| commit | f37e90436a21a906d3cef536871c3e1913a4a2b7 (patch) | |
| tree | 610b0762c52b6b444670c41b1205672d18d25aff /threads.js | |
| parent | 63a1d2ee3a6eb3a34ed26f316b85f266a584b3e3 (diff) | |
| download | snap-f37e90436a21a906d3cef536871c3e1913a4a2b7.tar.gz snap-f37e90436a21a906d3cef536871c3e1913a4a2b7.zip | |
renamed Process::callback to "onComplete"
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -237,8 +237,8 @@ ThreadManager.prototype.removeTerminatedProcesses = function () { } if (proc.topBlock instanceof ReporterBlockMorph) { - if (proc.callback) { - proc.callback(proc.homeContext.inputs[0]) + if (proc.onComplete instanceof Function) { + proc.onComplete(proc.homeContext.inputs[0]); } else { if (proc.homeContext.inputs[0] instanceof List) { proc.topBlock.showBubble( @@ -301,9 +301,9 @@ ThreadManager.prototype.findProcess = function (block) { are children receiver object (sprite) to which the process applies, cached from the top block - context the Context describing the current state + context the Context describing the current state of this process - homeContext stores information relevant to the whole process, + homeContext stores information relevant to the whole process, i.e. its receiver, result etc. isPaused boolean indicating whether to pause readyToYield boolean indicating whether to yield control to @@ -311,16 +311,17 @@ ThreadManager.prototype.findProcess = function (block) { readyToTerminate boolean indicating whether the stop method has been called isDead boolean indicating a terminated clone process - timeout msecs after which to force yield - lastYield msecs when the process last yielded - errorFlag boolean indicating whether an error was encountered + timeout msecs after which to force yield + lastYield msecs when the process last yielded + errorFlag boolean indicating whether an error was encountered prompter active instance of StagePrompterMorph httpRequest active instance of an HttpRequest or null pauseOffset msecs between the start of an interpolated operation and when the process was paused exportResult boolean flag indicating whether a picture of the top block along with the result bubble shoud be exported - callback a function to be executed when the process is done + onComplete an optional callback function to be executed when + the process is done */ Process.prototype = {}; @@ -328,7 +329,7 @@ Process.prototype.contructor = Process; Process.prototype.timeout = 500; // msecs after which to force yield Process.prototype.isCatchingErrors = true; -function Process(topBlock, callback) { +function Process(topBlock, onComplete) { this.topBlock = topBlock || null; this.readyToYield = false; @@ -345,7 +346,7 @@ function Process(topBlock, callback) { this.pauseOffset = null; this.frameCount = 0; this.exportResult = false; - this.callback = callback; + this.onComplete = onComplete || null; if (topBlock) { this.homeContext.receiver = topBlock.receiver(); @@ -444,7 +445,6 @@ Process.prototype.pauseStep = function () { Process.prototype.evaluateContext = function () { var exp = this.context.expression; this.frameCount += 1; - if (exp instanceof Array) { return this.evaluateSequence(exp); } @@ -484,7 +484,9 @@ Process.prototype.evaluateBlock = function (block, argCount) { } if (this.isCatchingErrors) { try { - this.returnValueToParentContext(rcvr[block.selector].apply(rcvr, inputs)); + this.returnValueToParentContext( + rcvr[block.selector].apply(rcvr, inputs) + ); this.popContext(); } catch (error) { this.handleError(error, block); |
