mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
print tree string and load from string
This commit is contained in:
parent
fcee1fa321
commit
5272cfea47
1 changed files with 13 additions and 0 deletions
13
src/git.js
13
src/git.js
|
@ -81,6 +81,15 @@ GitEngine.prototype.exportTree = function() {
|
|||
return totalExport;
|
||||
};
|
||||
|
||||
GitEngine.prototype.printTree = function() {
|
||||
var str = escape(JSON.stringify(this.exportTree()));
|
||||
return str;
|
||||
};
|
||||
|
||||
GitEngine.prototype.printAndCopyTree = function() {
|
||||
window.prompt('Copy the tree string below', this.printTree());
|
||||
};
|
||||
|
||||
GitEngine.prototype.loadTree = function(tree) {
|
||||
// first clear everything
|
||||
this.removeAll();
|
||||
|
@ -90,6 +99,10 @@ GitEngine.prototype.loadTree = function(tree) {
|
|||
this.reloadGraphics();
|
||||
};
|
||||
|
||||
GitEngine.prototype.loadTreeFromString = function(treeString) {
|
||||
this.loadTree(JSON.parse(unescape(treeString)));
|
||||
};
|
||||
|
||||
GitEngine.prototype.instantiateFromTree = function(tree) {
|
||||
// now we do the loading part
|
||||
var createdSoFar = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue