From d267b696af1e7a429c4b31dc87b46dc638c3509f Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 14 May 2013 16:16:21 +0200 Subject: Broadcast & Message enhancements, fixed #93 * When I receive option * getLastMessage reporter + watcher --- threads.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'threads.js') diff --git a/threads.js b/threads.js index 7068d38..2a1802c 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-April-19'; +modules.threads = '2013-May-14'; var ThreadManager; var Process; @@ -744,8 +744,7 @@ Process.prototype.evaluate = function ( extra, parms = args.asArray(), i, - value, - upvars; + value; if (!outer.receiver) { outer.receiver = context.receiver; // for custom blocks @@ -815,9 +814,7 @@ Process.prototype.evaluate = function ( } } } - if (upvars) { - runnable.upvars = upvars; - } else if (this.context.upvars) { + if (this.context.upvars) { runnable.upvars = new UpvarReference(this.context.upvars); } @@ -1665,6 +1662,7 @@ Process.prototype.doBroadcast = function (message) { procs = []; if (message !== '') { + stage.lastMessage = message; stage.children.concat(stage).forEach(function (morph) { if (morph instanceof SpriteMorph || morph instanceof StageMorph) { hats = hats.concat(morph.allHatBlocksFor(message)); @@ -1693,6 +1691,17 @@ Process.prototype.doBroadcastAndWait = function (message) { this.pushContext(); }; +Process.prototype.getLastMessage = function () { + var stage; + if (this.homeContext.receiver) { + stage = this.homeContext.receiver.parentThatIsA(StageMorph); + if (stage) { + return stage.getLastMessage(); + } + } + return ''; +}; + // Process type inference Process.prototype.reportIsA = function (thing, typeString) { -- cgit v1.3.1