Skip to content

Instantly share code, notes, and snippets.

@graph1zzlle
Last active December 15, 2015 09:09
Show Gist options
  • Save graph1zzlle/5236296 to your computer and use it in GitHub Desktop.
Save graph1zzlle/5236296 to your computer and use it in GitHub Desktop.
example of a NodeJS class
var thing = require('./thing.js');
/*****************************************************
* CLASS DEFINITION
****************************************************/
function someManager() {
this.thing = thing;
this.otherThing = {};
};
/*****************************************************
* METHODS
****************************************************/
someManager.prototype.someFunc1 = function (arg1, arg2) {
// somecode
};
someManager.prototype.someFunc2 = function (arg1) {
// somecode
};
/*****************************************************
* EXPORT
****************************************************/
module.exports = someManager(); // new someManager() if you want a singleton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment