Skip to content

Instantly share code, notes, and snippets.

@Silom
Last active December 17, 2015 16:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Silom/5636414 to your computer and use it in GitHub Desktop.
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
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