https://github.com/wolfchamane/amjs-factory
Provides a unique registry engine for singletons
https://github.com/wolfchamane/amjs-factory
commonjs es6 factory javascript nodejs singleton unique-registry-engine
Last synced: about 1 year ago
JSON representation
Provides a unique registry engine for singletons
- Host: GitHub
- URL: https://github.com/wolfchamane/amjs-factory
- Owner: Wolfchamane
- Created: 2019-01-23T16:23:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:38:32.000Z (over 3 years ago)
- Last Synced: 2025-03-11T22:48:09.929Z (about 1 year ago)
- Topics: commonjs, es6, factory, javascript, nodejs, singleton, unique-registry-engine
- Language: JavaScript
- Homepage:
- Size: 332 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @amjs/factory 0.2.9
> Provides a unique registry engine for singletons
[](https://www.npmjs.com/package/@amjs/factory)
## Installation
```bash
$ npm i --save @amjs/factory
```
## Use
```javascript
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
```