Skip to content

Instantly share code, notes, and snippets.

@batusa
Created July 24, 2014 19:51
Show Gist options
  • Save batusa/a261c8e5ee270e9de047 to your computer and use it in GitHub Desktop.
Save batusa/a261c8e5ee270e9de047 to your computer and use it in GitHub Desktop.
module pattern w jquery
// http://learn.jquery.com/code-organization/concepts/
$(function(){
"use strict";
var Foo = (function(){
var $element = $('#element');
var onClickElement = function(e){
justClicked();
};
var justClicked = function(){
alert('just clicked!');
};
return {
init: function(){
// event bindings come here
$element.on('click', onClickElement);
}
};
})();
Foo.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment