Skip to content

Instantly share code, notes, and snippets.

@erikakers
Last active December 21, 2015 03:19
Show Gist options
  • Save erikakers/6241840 to your computer and use it in GitHub Desktop.
Save erikakers/6241840 to your computer and use it in GitHub Desktop.
Javascript: Loose Augmentation Module Pattern
App.Features.customFeature = (function(feature){
var els = {};
setEls = function(element) {
/* Cache any selectors that are needed */
/* els.element = $('.element') if using jQuery*/
};
method = function() {
/* Method/function to make magic happen. Add as many of this as need
* and keep the funtions short and reused able.
*/
};
feature.init = function(element) {
/* Call functions to fire when the feature on init. */
setEls(element);
}
return feature;
}(App.Features.customFeature || {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment