rk

redux-kefir

Kefir bindings for Redux

Showing:

Popularity

Downloads/wk

11

Maintenance

No Maintenance Data Available

Package

Dependencies

1

Size (min+gzip)

10.8KB

License

MIT

Type Definitions

Tree-Shakeable

Yes?

Categories

Readme

redux-kefir

Kefir bindings for Redux

Test Coverage Build Status

npm install --save redux-kefir

createProjection(store: ReduxStore): KefirProperty

Creates an observable of state over time from a Redux store.

import { createProjection } from 'redux-kefir'

Usage

Given store, create a projection:

let stateProjection = createProjection(store)

To do anything useful with the newly minted stateProjection, we must use the Kefir API.


observableMiddleware: ReduxMiddleware

Enables dispatching Kefir observables and Flux Standard Actions that have observable payloads.

import { observableMiddleware } from 'redux-kefir'

Usage

createStore = applyMiddleware(observableMiddleware)(createStore)

Given a store and an action creator count(payload: number): FSA, dispatch a stream of count actions. For clarity and DRY, we'll define a stream creator obs:

let obs = () => Kefir.sequentially(50, [1,2,3])

Dispatch new observable stream, mapping its values through the action creator:

store.dispatch(obs().map(count))

Or dispatch an FSA that has observable payload, essentially, inverting control:

store.dispatch(count(obs()))

Both examples have the same outcome:

at t + 0.05s dispatched {type: "count", payload: 1},
at t + 0.10s dispatched {type: "count", payload: 2},
at t + 0.15s dispatched {type: "count", payload: 3},
then ended.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100