Last active
August 18, 2017 23:54
-
-
Save dineshsprabu/2365cae699af8da9c0a2 to your computer and use it in GitHub Desktop.
Export multiple Prototypes from one file in Nodejs
This file contains hidden or 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
/* protos.js*/ | |
var hey = function(){ | |
} | |
hey.prototype.sayHey = function(){ | |
console.log('Hey'); | |
} | |
var bye = function(){ | |
} | |
bye.prototype.sayBye = function(){ | |
console.log('Bye'); | |
} | |
module.exports.hey = hey; | |
module.exports.bye = bye; | |
/* use.js */ | |
var hey = require('./protos').hey | |
var bye = require('./protos').bye | |
hey = new hey(); | |
hey.sayHey(); | |
bye = new bye(); | |
bye.sayBye(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment