Skip to content

Instantly share code, notes, and snippets.

@lstanard
Last active December 23, 2015 05:09
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 lstanard/6584752 to your computer and use it in GitHub Desktop.
Save lstanard/6584752 to your computer and use it in GitHub Desktop.
JavaScript Design Pattern: Module Pattern - Example 01
// 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