An open API service indexing awesome lists of open source software.

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

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 --save

yarn 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 Hoyle

https://github.com/deployable/deployable-mixin-instances