Skip to content

Instantly share code, notes, and snippets.

@markbrown4
Created August 16, 2011 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markbrown4/1148446 to your computer and use it in GitHub Desktop.
Save markbrown4/1148446 to your computer and use it in GitHub Desktop.
Controls
var Page = {
init: function() {
Controls.init();
}
}
// Lets go
var $body = $("body");
$(document).ready(Page.init);
var Controls = {
init: function() {
Controls.initWithin(document);
},
initWithin: function(el) {
$(el).find('.init').each(function() {
var name = $(this).attr('data-control');
var control = Controls[name];
if (control.initOnce) {
control.initOnce.call(this);
control.initOnce = false;
}
if (control.init)
control.init.call(this);
});
}
}
Controls.Superman = {
initOnce: function() {
},
init() {
var $this = $(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment