Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.59 KB

README.md

File metadata and controls

54 lines (43 loc) · 1.59 KB

simple-store

NPM version build status Test coverage Downloads js-standard-style

Event emitting data store.

Installation

$ npm install simple-store

Usage

const store = require('simple-store')
const user = store('user')

user.on('data', val => console.log(val))
user({name: 'Tobi', age: 12})

user()
// => {name: 'Tobi', age: 12}

API

s = store(name)

Initialize a store with a name.

s(value)

Set the store to contain a value. Emits a data event. Alias: .set(value).

s()

Get a value from the store. Alias: .get().

Events

data - emitted whenever the value in the store is set

License

MIT