Created
February 1, 2012 19:04
-
-
Save mzgoddard/1718679 to your computer and use it in GitHub Desktop.
New Wrapper
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
// this is an idea, a paradigm, not a function that is reused | |
// an example with World | |
wrapper.World = function(options) { | |
this.stuff = stuff; | |
}; | |
bullet.world = function(options) { | |
return new wrapper.World(options); | |
}; | |
// the "wrapper" is a light-weight function that returns a new instance of an object. | |
// a factory function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment