Created
May 13, 2014 10:12
-
-
Save asicfr/69f4275b9c49f0fdc0a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Start polymer | |
Polymer('polymer-filesystem', { | |
created: function() { | |
console.log("created"); | |
// bind function 'callBackRefreshList' and 'callBackFsmChangeState' with 'this' current context | |
this.fsm = new fileSystemManager(this.callBackFsmChangeState.bind(this)); | |
this.fsm.setCallBackAfterLoad(this.callBackRefreshList.bind(this)); | |
console.log("fin created"); | |
}, | |
ready: function() { | |
console.log("ready"); | |
this.myfiles = []; | |
}, | |
refreshList: function(event, detail, sender) { | |
console.log("refreshList"); | |
this.fsm.loadFiles(); | |
}, | |
callBackFsmChangeState: function() { | |
console.log("callBackFsmChangeState"); | |
this.systemOk = this.fsm.isInit(); | |
this.systemError = this.fsm.getError(); | |
if (this.systemOk) { | |
this.fsm.loadFiles(); | |
} | |
}, | |
callBackRefreshList: function(newList) { | |
console.log("newList size : " + newList.length); | |
this.myfiles = newList; | |
}, | |
openSomeFile: function(event, detail, sender) { | |
console.log("openSomeFile"); | |
window.open(sender.templateInstance.model.onefile.fileURL) | |
}, | |
removeSomeFile: function(event, detail, sender) { | |
console.log("removeSomeFile"); | |
// access the current named model instance that in a template repeat | |
var fileName = sender.templateInstance.model.onefile.name; | |
this.fsm.removeFile(fileName); | |
}, | |
addSomeFile: function(event, detail, sender) { | |
console.log("addSomeFile"); | |
this.fsm.addFile(sender); | |
} | |
}); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment