Created
June 17, 2013 14:19
-
-
Save morningtoast/5797227 to your computer and use it in GitHub Desktop.
JS Module Pattern
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
| var MyModule = (function($, Modernizr) { | |
| // Module variables. Use for local tracking | |
| var data = { | |
| } | |
| // Module init; This will run during onready if module is defined in the <body> data attribute | |
| var init = function() { | |
| _debug("main.init()"); | |
| } | |
| // Local methods | |
| var local = { | |
| } | |
| // Module bindings | |
| var bind = { | |
| } | |
| return { | |
| init: init, | |
| data: data | |
| }; | |
| }(jQuery, Modernizr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment