kopia lustrzana https://github.com/backface/turtlestitch
added newList() to Snap API
rodzic
9b3ae88c3e
commit
de22d4ef4a
16
src/api.js
16
src/api.js
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
prerequisites:
|
prerequisites:
|
||||||
--------------
|
--------------
|
||||||
needs gui.js and morphic.js
|
needs gui.js, lists.js and morphic.js
|
||||||
|
|
||||||
|
|
||||||
documentation
|
documentation
|
||||||
|
@ -54,6 +54,10 @@
|
||||||
- IDE_Morph.prototype.getVar()
|
- IDE_Morph.prototype.getVar()
|
||||||
- IDE_Morph.prototype.setVar()
|
- IDE_Morph.prototype.setVar()
|
||||||
|
|
||||||
|
Create and Modify Lists
|
||||||
|
|
||||||
|
- IDE_Morph.prototype.newList()
|
||||||
|
|
||||||
Getting hold of an ide can usually be achieved by
|
Getting hold of an ide can usually be achieved by
|
||||||
evaluating:
|
evaluating:
|
||||||
|
|
||||||
|
@ -192,11 +196,11 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*global modules, IDE_Morph, isString, Map*/
|
/*global modules, IDE_Morph, isString, Map, List*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.api = '2020-April-27';
|
modules.api = '2020-July-06';
|
||||||
|
|
||||||
// IDE_Morph external communication API - experimental
|
// IDE_Morph external communication API - experimental
|
||||||
/*
|
/*
|
||||||
|
@ -303,3 +307,9 @@ IDE_Morph.prototype.setVar = function (name, value) {
|
||||||
// raise an error if no global variable of that name exists
|
// raise an error if no global variable of that name exists
|
||||||
this.stage.globalVariables().setVar(name, value);
|
this.stage.globalVariables().setVar(name, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IDE_Morph.prototype.newList = function (array) {
|
||||||
|
// return a new Snap list the shape of the given array, if any
|
||||||
|
// nested array will not be automatically converted to nested lists
|
||||||
|
return new List(array);
|
||||||
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue