Skip to content

Instantly share code, notes, and snippets.

@andrewjamesford
Last active September 30, 2017 15:28
Show Gist options
  • Save andrewjamesford/3300374 to your computer and use it in GitHub Desktop.
Save andrewjamesford/3300374 to your computer and use it in GitHub Desktop.
jQuery singleton boilerplate
var App = ( function () {
return {
init: function() {
this.cacheElements();
this.bindEvents();
},
cacheElements: function() {
this.$myid = $('#myid');
},
bindEvents: function() {
this.$myid.on('click', this.appMethod);
},
appMethod: function() {
//do action
}
};
} )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment