Last active
December 15, 2015 09:09
-
-
Save graph1zzlle/5236296 to your computer and use it in GitHub Desktop.
example of a NodeJS class
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
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