https://github.com/deployable/node-deployable-mixin-instances
Node Static Instances Mixin
https://github.com/deployable/node-deployable-mixin-instances
class-instance deployable mixins nodejs npm-module
Last synced: about 2 months ago
JSON representation
Node Static Instances Mixin
- Host: GitHub
- URL: https://github.com/deployable/node-deployable-mixin-instances
- Owner: deployable
- Created: 2017-01-03T03:24:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-03T03:54:16.000Z (over 8 years ago)
- Last Synced: 2025-03-10T15:15:50.201Z (3 months ago)
- Topics: class-instance, deployable, mixins, nodejs, npm-module
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [deployable-mixin-instances](https://github.com/deployable/deployable-mixin-instances)
Node Instances Mixin for use with [MixWith](https://github.com/justinfagnani/mixwith.js)
## Install
npm install deployable-mixin-instances --saveyarn add deployable-mixin-instances
## Usage
```javascript
const mix = require('mixwith').mix
const MixinInstances = require('deployable-mixin-instances')
class Some extends mix((class {})).with(MixinInstances) {}let default = Some.singleton
```
## API
### `getInstance(name)`
Get an exiting instance, can return undefined
### `newInstance(name, args)`
Create a new instance
### `fetchInstance(name, args)`
Fetch an existing or create a new instance
### `createInstance(name, args)`
Create an instance, erroring if it already exists
### `clearInstances()`
Clear all instance stored in the class
## License
deployable-mixin-instances is released under the MIT license.
Copyright 2016 Matt Hoylehttps://github.com/deployable/deployable-mixin-instances