single-space
v1.0.0
Published
Provides a simple way for ensuring the important parts of your module load only once.
Downloads
2
Readme
single-space
A module which provides a simple way for ensuring singleton in node.
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;
});