@amjs/factory
v0.2.9
Published
Provides a unique registry engine for singletons
Downloads
11
Maintainers
Readme
@amjs/factory 0.2.9
Provides a unique registry engine for singletons
Installation
$ npm i --save @amjs/factory
Use
const AmFactory = require('@amjs/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