Created
July 24, 2014 19:51
-
-
Save batusa/a261c8e5ee270e9de047 to your computer and use it in GitHub Desktop.
module pattern w jquery
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
// 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