Last active
December 17, 2015 16:09
-
-
Save Silom/5636414 to your computer and use it in GitHub Desktop.
A very easy javascript inheritance pattern. I use it for my node.js projects and I love it
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
module.exports = function () { | |
var self = {}; | |
self.run = function () { | |
console.log("Hello I'm a method"); | |
}; | |
return self; | |
}; | |
/* | |
* We can now construct this using: | |
* var pattern = require("./path/pattern.js"); | |
* pattern().run(); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment