Created
October 29, 2013 07:08
-
-
Save pbrewczynski/7210229 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var app = { | |
// Application Constructor | |
el : { | |
header : "heder", | |
fileList : "file-list", | |
footer : "footer" | |
} | |
initialize: function() { | |
this.bindEvents(); | |
}, | |
// Bind Event Listeners | |
// | |
// Bind any events that are required on startup. Common events are: | |
// 'load', 'deviceready', 'offline', and 'online'. | |
bindEvents: function() { | |
document.addEventListener('deviceready', this.onDeviceReady, false); | |
}, | |
// deviceready Event Handler | |
// | |
// The scope of 'this' is the event. In order to call the 'receivedEvent' | |
// function, we must explicity call 'app.receivedEvent(...);' | |
onDeviceReady: function() { | |
app.receivedEvent('deviceready'); | |
}, | |
// Update DOM on a Received Event | |
receivedEvent: function(id) { | |
app.el.header = document.getElementById(app.el.header); | |
app.el.fileList = document.getElementById(app.el.fileList); | |
app.el.footer = document.getElementById(app.el.footer); | |
/*var parentElement = document.getElementById(id); | |
var listeningElement = parentElement.querySelector('.listening'); | |
var receivedElement = parentElement.querySelector('.received'); | |
listeningElement.setAttribute('style', 'display:none;'); | |
receivedElement.setAttribute('style', 'display:block;'); | |
console.log('Received Event: ' + id);*/ | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment