|
|
|
@ -3,20 +3,29 @@ class Controller {
|
|
|
|
|
this.model = model;
|
|
|
|
|
this.view = view;
|
|
|
|
|
|
|
|
|
|
this.redrawDirTree(view);
|
|
|
|
|
|
|
|
|
|
// Initialize isomorphic-git with a file system
|
|
|
|
|
window.fs = new LightningFS("fs");
|
|
|
|
|
// I prefer using the Promisified version honestly
|
|
|
|
|
window.pfs = window.fs.promises;
|
|
|
|
|
var cloneBtn = document.getElementsByClassName("clone")[0];
|
|
|
|
|
var purgeBtn = document.getElementsByClassName("purge")[0];
|
|
|
|
|
cloneBtn.addEventListener("click", function () {
|
|
|
|
|
console.log("clone");
|
|
|
|
|
});
|
|
|
|
|
purgeBtn.addEventListener("click", this.purgeFS.bind(this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.dir = "/test-clone";
|
|
|
|
|
purgeFS() {
|
|
|
|
|
this.model.purgeFS();
|
|
|
|
|
//this.drawDirTree(this.view);
|
|
|
|
|
this.redrawDirTree(this.view);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
redrawDirTree(view) {
|
|
|
|
|
this.model.dirTree().then(
|
|
|
|
|
function (value) {
|
|
|
|
|
view.showDirTree(value);
|
|
|
|
|
view.removeDirTree();
|
|
|
|
|
view.drawDirTree(value);
|
|
|
|
|
},
|
|
|
|
|
function (error) {}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|