From 81f7461f8090554b507dabce3f08b2ad4c7e015f Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 20 Oct 2020 17:46:40 +0200 Subject: [PATCH] added getProjectXML() method to API --- API.md | 21 ++++++++++++++++++--- HISTORY.md | 1 + snap.html | 2 +- src/api.js | 10 +++++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/API.md b/API.md index 10b3f303..7dfdfab8 100755 --- a/API.md +++ b/API.md @@ -1,6 +1,6 @@ # The Snap! API -Jens Mönig, July 07, 2020 +Jens Mönig, October 20, 2020 This document describes how Snap! can be accessed from an outside program to start scripts, send and retrieve information. The model use case is embedding interactive Snap! projects in other websites such as MOOCs or other adaptive learning platforms. @@ -28,6 +28,10 @@ Currently the API consists of the following methods: * IDE_Morph.prototype.newList() +#### Access the Serialized Project + +* IDE_Morph.prototype.getProjectXML() + ## Referencing the IDE Getting hold of an ide can usually be achieved by @@ -113,7 +117,7 @@ The getMessage() method returns a new Array that contains all the message string ide.getMessages(); #### return value -an Array of strings, or an empty Array +an Array of Strings, or an empty Array ### IDE_Morph.prototype.getVarNames() @@ -123,7 +127,7 @@ The getVarNames() method returns a new Array that contains all the global variab ide.getVarNames(); ### return value -an Array of strings, or an empty Array +an Array of Strings, or an empty Array ### IDE_Morph.prototype.getVar() @@ -145,6 +149,7 @@ The setVar() methods assigns a value to the a global variable specified by name. #### return value undefined + ### IDE_Morph.prototype.newList() The newList() methods returns a new Snap! list. Optionally a source array containing the list elements can be specified. @@ -154,6 +159,16 @@ The newList() methods returns a new Snap! list. Optionally a source array contai #### return value a new Snap! List + +### IDE_Morph.prototype.getProjectXML() +the getProjectXML() method returns a string in XML format representing the serialized project currently loaded into the IDE. + +#### syntax + ide.getProjectXML(); + +#### return value +an XML String + ## Manipulating Lists Snap! lists can be accessed and manipulated through a set of methods described in the file `lists.js` diff --git a/HISTORY.md b/HISTORY.md index 7e3418a0..02f4603e 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,7 @@ * morphic: enabled zero values for menu selection entries * blocks: fixed translation bug for zero-value menu selection entries * Russian translation update, thanks, Pavel! +* api: added getProjectXML() method ### 2020-10-15 * new dev version diff --git a/snap.html b/snap.html index 8f6da66b..6fad0f83 100755 --- a/snap.html +++ b/snap.html @@ -23,7 +23,7 @@ - +