added global variable access methods to the new Snap! API

pull/89/head
jmoenig 2019-12-15 23:06:35 +01:00
rodzic d519a10f93
commit af8480aca2
2 zmienionych plików z 19 dodań i 0 usunięć

Wyświetl plik

@ -6,6 +6,7 @@
* export pen trails as SVG
* access pen trails as SVG_Costume: new "pen vectors" reporter variant of "pen trails"
* new Snap! API: programmatically broadcast messages and optionally wait from outside Snap!
* new Snap! API: programmatically get and set global variables from outside Snap!
* **Notable Changes:**
* when creating a costume from pen trails (raster or vector) make its rotation center the position of the sprite
* **Notable Fixes:**
@ -16,6 +17,7 @@
### 2019-12-15
* gui, threads: new Snap! API: programmatically broadcast messages and optionally wait from outside Snap!
* gui: added global variable access methods to the new Snap! API
### 2019-12-13
* added direct relabelling option to pen trails blocks' context menus

Wyświetl plik

@ -6102,6 +6102,23 @@ IDE_Morph.prototype.broadcast = function(message, callback) {
});
};
IDE_Morph.prototype.getVarNames = function () {
// return an array of all global variable names
return this.stage.globalVariables().names();
};
IDE_Morph.prototype.getVar = function (name) {
// return the value of the global variable indicated by name
// raise an error if no global variable of that name exists
return this.stage.globalVariables().getVar(name);
};
IDE_Morph.prototype.setVar = function (name, value) {
// set the value of the global variable indicated by name to the given value
// raise an error if no global variable of that name exists
this.stage.globalVariables().setVar(name, value);
};
// ProjectDialogMorph ////////////////////////////////////////////////////
// ProjectDialogMorph inherits from DialogBoxMorph: