-
-
Save ansco05069/7376176 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
!function(window, document, undefined){ | |
plugins = [];//Plugin storage object | |
function constructorObject(options){//object constructor | |
var self = this; //store itself for later | |
plugins.forEach(function(plugin){ | |
plugin(self, options);//pass this instance of the constructed object to the plugin | |
//the options used to construct it are also passed as well | |
}); | |
} | |
constructorObject.plugin = function(func){//function to define plugins exposed | |
plugins.push(func);//append the plugin | |
}; | |
window["constructorObject"] = constructorObject;//expose the constructor | |
}(window,document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment