Last active
December 21, 2015 03:19
-
-
Save erikakers/6241840 to your computer and use it in GitHub Desktop.
Javascript: Loose Augmentation 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
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