Last active
August 29, 2015 14:03
-
-
Save JamesHagerman/183587fe3d4fa449840b to your computer and use it in GitHub Desktop.
A basic JS app boilerplate
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
// A Simple namespace | |
var App = (function () { | |
return { | |
ctx: null, | |
theTime: null, | |
init: function () { | |
console.log("init"); | |
this.setupCanvas(); | |
this.load(); | |
}, | |
load: function () { | |
console.log("load"); | |
setInterval(this.update, 100); | |
}, | |
update: function() { | |
//console.log("."); | |
}, | |
draw: function() { | |
}, | |
setupCanvas: function() { | |
this.ctx = $('#theCanvas')[0].getContext('2d'); | |
} | |
}; | |
})(); | |
// A Simple Object | |
function SomeObject() { | |
// constructor | |
} | |
SomeObject.prototype = { | |
// methods and instance variables | |
}; | |
// Entry point | |
$(document).ready(function () { | |
console.log("running..."); | |
App.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment