Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript Module Pattern Example with "Passive Attachment"
/** JavaScript Module Pattern Example with "Passive Attachment"
*/
(function(
win,
doc,
$,
a,
b
){
// "Passively attach" your new module to global through your namespace,
// i.e., attach only if your module name doesn't already exist to avoid
// clobbering existing modules with the same name
my.namespace.c = my.namespace.c || function(){
var self = this;
// Create "private" module properties
var privPropA = ...;
var privPropB = function(){...};
// Create "public" module properties
self.pubPropA = ...;
self.pubPropB = function(){...};
// Use "imported" modules
$(doc).ready(function(){...})
a();
b();
return self;
};
})(
window,
document,
jQuery,
my.namespace.a,
my.namespace.b
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.