Created
May 22, 2013 20:05
-
-
Save wolffc/5630476 to your computer and use it in GitHub Desktop.
jQuery: Module Pattern Template
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
// jQuery Module Pattern | |
(function($) { | |
// The jQuery function | |
$.MyModuleName = function(options) { | |
var mod = { | |
options: $.extend( | |
// Default Options | |
{ | |
'optionaName1': 'defaultValue', | |
'optionaName2': 'defaultValue2', | |
}, options), | |
// Private functions | |
privFunction: function( ) { | |
// call obect function via this | |
this.privFunction2( ); | |
}, | |
privFunction2: function( ) { | |
}, | |
}; | |
// Pulic Api Exposed | |
return { | |
publicFunctionName: mod.privFunction, | |
publicFunctionName2: mod.privFunction2, | |
}; | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment