class Controller { constructor(model, view) { this.model = model; this.view = view; this.redrawDirTree(view); var cloneBtn = document.getElementsByClassName("clone")[0]; var purgeBtn = document.getElementsByClassName("purge")[0]; cloneBtn.addEventListener("click", this.cloneRep.bind(this)); purgeBtn.addEventListener("click", this.purgeFS.bind(this)); } purgeFS() { this.model.purgeFS(); //window.location.reload(); this.redrawDirTree(this.view); } cloneRep(repurl) { var that = this; this.model.cloneRep().then( function (value) { that.redrawDirTree(that.view); }, function (error) {} ); } redrawDirTree(view) { this.model.dirTree().then( function (value) { view.removeDirTree(); view.drawDirTree(value); view.dirTreeToggler(); }, function (error) {} ); } }