added unsavedChanges() method and documentation to the Snap! API

pull/95/head
jmoenig 2020-12-22 00:35:29 +01:00
rodzic 79d022acf2
commit 65efa0e316
4 zmienionych plików z 21 dodań i 3 usunięć

13
API.md
Wyświetl plik

@ -1,6 +1,6 @@
# The Snap! API
Jens Mönig, Bernat Romagosa, November 21, 2020
Jens Mönig, Bernat Romagosa, December 22, 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.
@ -32,6 +32,7 @@ Currently the API consists of the following methods:
* IDE_Morph.prototype.getProjectXML()
* IDE_Morph.prototype.loadProjectXML()
* IDE_Morph.prototype.unsavedChanges()
## Referencing the IDE
@ -213,6 +214,16 @@ the loadProjectXML() method replaces the current project of the IDE with another
unefined
### IDE_Morph.prototype.unsavedChanges()
the unsavedChanges() method return a Boolean value indicating whether the currently edited project has been modifed since it was last saved.
#### syntax
ide.unsavedChanges();
#### return value
a Boolean
## Manipulating Lists
Snap! lists can be accessed and manipulated through a set of methods described in the file `lists.js`

Wyświetl plik

@ -14,12 +14,14 @@
* fixed keyboard formula entry for subtraction
* **Documentation Updates:**
* new Manual for v6.5, thanks, Brian!
* added unsavedChanges() method and documentation to the Snap! API
* **Translation Updates:**
* German
* Catalan, thanks, Joan!
### 2020-12-22
* threads: up to 40x speed-up for "new costume from list" reporter primitive
* api: added unsavedChanges() method and documentation
### 2020-12-21
* gui: tweaked backup / restore

Wyświetl plik

@ -23,7 +23,7 @@
<script src="src/store.js?version=2020-12-11"></script>
<script src="src/locale.js?version=2020-12-21"></script>
<script src="src/cloud.js?version=2020-10-21"></script>
<script src="src/api.js?version=2020-11-21"></script>
<script src="src/api.js?version=2020-12-22"></script>
<script src="src/sha512.js?version=2019-06-27"></script>
<script src="src/FileSaver.min.js?version=2019-06-27"></script>
<script>

Wyświetl plik

@ -62,6 +62,7 @@
- IDE_Morph.prototype.getProjectXML()
- IDE_Morph.prototype.loadProjectXML(projectXML)
- IDE_Morph.prototype.unsavedChanges()
Getting hold of an ide can usually be achieved by
evaluating:
@ -205,7 +206,7 @@
// Global stuff ////////////////////////////////////////////////////////
modules.api = '2020-November-21';
modules.api = '2020-December-22';
// IDE_Morph external communication API - experimental
/*
@ -342,3 +343,7 @@ IDE_Morph.prototype.loadProjectXML = function (projectXML) {
this.world().animations = [];
this.openProjectString(projectXML);
};
IDE_Morph.prototype.unsavedChange = function () {
return this.hasUnsavedEdits;
};