singleton

1.0.0 • Public • Published

singleton

singleton javascript class

The most tested singleton javascript class ever

BuildStatus

Example

singleton = require '../lib/singleton'

class TestClass extends singleton
  constructor:(@instantiated_time = (new Date()).toString())->
    @testString = 'hello'

module.exports = TestClass.get()
(function() {
  var TestClass, singleton,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  singleton = require('../lib/singleton');

  TestClass = (function(_super) {

    __extends(TestClass, _super);

    function TestClass(instantiated_time) {
      this.instantiated_time = instantiated_time != null ? instantiated_time : (new Date()).toString();
      this.testString = 'hello';
    }

    return TestClass;

  })(singleton);

  module.exports = TestClass.get();

}).call(this);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2,789
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    2,789
  • 0.0.3
    3
  • 0.0.2
    3

Package Sidebar

Install

npm i singleton

Weekly Downloads

2,795

Version

1.0.0

License

none

Last publish

Collaborators

  • wlaurance