0.0.2 • Published 8 years ago
emitterer v0.0.2
emitterer
Because the world needs more event interfaces
example
var Store = require('emitterer')
// initial state
var store = Store({})
// call me when state changes
store(function onChange(state) {
console.log(state)
})
// get current state
console.log(store())
// return an object that will xtend `oldState`
store.on('data', function(action, oldState) {
return action
})
// pass something to the 'data' listener
store.emit('data', { test: 'party' })