future-state
v1.0.2
Published
Subscribe to future values in a Redux store.
Downloads
2
Readme
future-state
Subscribe to future values in a Redux store.
Why?
You know that eventually some values will show up in your Redux state and you want to get them as soon as they appear.
Usage
import futureState from 'future-state'
// wait for a value
futureState(reduxStore, 'foo.bar.baz')
.then(bar => console.log('Hi, bar!', bar))
// or multiple values
futureState(reduxStore, ['foo.bar.baz', 'bingo.bango'])
.then(values => {
console.log('foo.bar.baz', values[0])
console.log('bingo.bango', values[1])
})
As soon as your value(s) are in the state the promise is resolved. The subscriptions are removed and pasted over with rubber cement to prevent memory leaks.
Installation
Download this random zip file from a suspicious fileserver and... just kidding.
yarn add future-state
Feedback
Bug reports, PRs, and comments are always welcome!
kickstarted by npm-boom