Created
July 15, 2013 14:33
-
-
Save ultim8k/6000413 to your computer and use it in GitHub Desktop.
A front-end app scaffold
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
/** | |
* app template | |
*/ | |
var app = {} | |
app.settings = { | |
init_msg : "Thanks Kostas.\nYou are awesome!" | |
} | |
app.consolefix = function(){ | |
var self = this | |
var s = self.settings | |
if (typeof console == "undefined") { | |
this.console = { log: function() {} }; | |
} | |
return false; | |
} | |
app.call = function(data, callback){ | |
var self = this | |
var s = self.settings | |
if(callback && typeof callback == 'function'){ | |
callback(data) | |
}else{ | |
console.log(data || 'I find your lack of data disturbing!') | |
} | |
} | |
app.events = function(){ | |
var self = this | |
var s = self.settings | |
window.onhashchange = function(){ | |
if(window.location.hash == '#init'){ | |
self.call(s.init_msg) | |
} | |
} | |
} | |
app.init = function(){ | |
var self = this | |
var s = self.settings | |
self.events() | |
self.call('app initialized') | |
} | |
app.init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment