Skip to content

A module which provides a simple way for ensuring singleton in node.

License

Notifications You must be signed in to change notification settings

CodeMedic42/single-space

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

single-space

A module which provides a simple way for ensuring singleton in node.

npm version Build Status Coverage Status

Code copied and modified gently from

https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/

Thanks to this developer.

Ussage

const SingleSpace = require('single-space');

module.exports = SingleSpace('module.my.namespace.example', () => {
    function Example(options) {
        if (!(this instanceof Example)) {
            return new Example(options);
        }

        this.options = options;
    }

    Example.prototype.echo = function echo(sound) {
        return sound;
    }

    return Example;
});

About

A module which provides a simple way for ensuring singleton in node.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published