Last active
December 23, 2015 05:09
-
-
Save lstanard/6584752 to your computer and use it in GitHub Desktop.
JavaScript Design Pattern: Module Pattern - Example 01
This file contains 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
// If using jQuery, must be wrapped in a $(document).ready function | |
$(document).ready(function(){ | |
(function ($, MyObject) { | |
var _root = this, | |
_config = { | |
'option': 'value' | |
}, | |
_init = function() { | |
// Do something | |
}; | |
this.somePublicMethod = function() { | |
// Do Something | |
}; | |
_init(); | |
}(jQuery, window.MyObject = window.MyObject || {})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment