-
-
Save jtenner/7416928 to your computer and use it in GitHub Desktop.
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
!{ | |
//Typical API functions should go here | |
//func : function(){}.... | |
//func2 : function(options){...} | |
//Object creation methods... | |
//convenience methods here for create and expose via this | |
createObject: function(options){ | |
//constructor logic here | |
var created = Object.create(this.fn); | |
var args = [].slice.call(arguments); | |
this.plugins.forEach(function(plugin){ | |
plugin.apply(created, args); | |
}); | |
return created; | |
}, | |
fn:{//prototype methods here | |
}, | |
expose:function(NameSpace, target, plugins){//initialization code. | |
target[NameSpace] = this;//target can be the window (exposed) or some other object | |
this.plugins = plugins; | |
delete this.expose; //remove the reference to expose | |
} | |
}.expose("LibraryNamespaceHere", {}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment