1.0.0 • Published 11 years ago
node-singleton-getter v1.0.0
Simple singleton getter fro NodeJs
##Installation
$ npm install node-singleton-getter
##Usage
var addSingletonGetter = require('node-singleton-getter');
function SingletonClass() {}
SingletonClass.prototype.hello = function() {
console.log('Hello Node.');
}
//Call node-singleton-getter with the constructor
//to attach 'instance' property.
addSingletonGetter(SingletonClass);
//To use singleton class,
//simply access to the 'instance' static property.
var instance = SingletonClass.instance;
//console output 'Hello Node.'
instance.hello();
1.0.0
11 years ago