kopia lustrzana https://github.com/backface/turtlestitch
added IDE >> getMessages() to Snap! API
rodzic
ebc456d5f1
commit
9605b6eb73
|
@ -18,6 +18,7 @@
|
|||
|
||||
### 2019-12-16
|
||||
* gui, objects: added ability to add general message listeners for "any" message
|
||||
* gui: added IDE >> getMessages() to Snap! API
|
||||
|
||||
### 2019-12-15
|
||||
* gui, threads: new Snap! API: programmatically broadcast messages and optionally wait from outside Snap!
|
||||
|
|
15
src/gui.js
15
src/gui.js
|
@ -61,7 +61,7 @@
|
|||
|
||||
*/
|
||||
|
||||
/*global modules, Morph, SpriteMorph, SyntaxElementMorph, Color, Cloud,
|
||||
/*global modules, Morph, SpriteMorph, SyntaxElementMorph, Color, Cloud, Map,
|
||||
ListWatcherMorph, TextMorph, newCanvas, useBlurredShadows, VariableFrame,
|
||||
StringMorph, Point, MenuMorph, morphicVersion, DialogBoxMorph, normalizeCanvas,
|
||||
ToggleButtonMorph, contains, ScrollFrameMorph, StageMorph, PushButtonMorph, sb,
|
||||
|
@ -6133,6 +6133,19 @@ IDE_Morph.prototype.addMessageListener = function (message, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.getMessages = function () {
|
||||
// return an array of all broadcast messages in the current project
|
||||
var allNames = [],
|
||||
dict = new Map();
|
||||
this.sprites.contents.concat(this.stage).forEach(function (sprite) {
|
||||
allNames = allNames.concat(sprite.allMessageNames());
|
||||
});
|
||||
allNames.forEach(function (name) {
|
||||
dict.set(name);
|
||||
});
|
||||
return Array.from(dict.keys());
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.getVarNames = function () {
|
||||
// return an array of all global variable names
|
||||
return this.stage.globalVariables().names();
|
||||
|
|
Ładowanie…
Reference in New Issue