Skip to content

yoshuawuyts/simple-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

event emitting data store

Resources

License

Stars

Watchers

Forks

Packages

No packages published