1.0.0 • Published 11 years ago

node-singleton-getter v1.0.0

Weekly downloads
7
License
-
Repository
github
Last release
11 years ago

Simple singleton getter fro NodeJs

##Installation

npm

$ 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();