future-state

1.0.2 • Public • Published

future-state

Build Status

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

Readme

Keywords

none

Package Sidebar

Install

npm i future-state

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

119 kB

Total Files

10

Last publish

Collaborators

  • reergymerej