@arturomartinezdiaz/factory
v0.2.4
Published
Provides a unique registry engine for singletons
Downloads
8
Maintainers
Readme
am-factory
Provides a unique registry engine for singletons
Installation
$ npm i --save @arturomartinezdiaz/factory
Use
const AmFactory = require('@arturomartinezdiaz/factory');
class MyClass
{
constructor()
{
this.index = 0;
}
setProperties(values)
{
// do somthing with 'values'
}
}
// Registration
AmFactory.register('MyClass', MyClass);
// Creation
const _instance = AmFactory.create('MyClass', { index : 1 });
console.log(_instance.index); // 1