Created
February 15, 2016 15:38
-
-
Save catacs/7ab71698aa3b1e84ebf1 to your computer and use it in GitHub Desktop.
Factory pattern javascript
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
// Constructor | |
var Class = function(value1, value2) { } | |
// Factory | |
Class.factory(value1) { | |
return new Class(value1, 'aaa'); | |
}; | |
// properties and methods | |
Class.prototype = { ... }; | |
// http://blog.mixu.net/2011/02/02/essential-node-js-patterns-and-snippets/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment