@duckness/pool-saga-stream
@duckness/saga plugin for @duckness/pool
Example
import Pool from '@duckness/pool'
import PoolSagaStream from '@duckness/pool-saga-stream'
import CounterSagaDuck from './ducks/CounterSagaDuck'
const CounterPool = Pool({
buildStore: ({ initialCounter = 0 } = {}) => {
return { counter: initialCounter }
}
})
CounterPool.addDuck(CounterSagaDuck)
CounterPool.addStream(PoolSagaStream())
CounterPool.build({initialCounter: 0})
CounterPool.store
// => [redux store]
Table of Contents
API
Create Pool Saga Stream
PoolSagaStream({
// build custom root saga from ducks instead of default root saga
?buildRootSaga: (ducks, { refDucks, refErrorReporter }) => rootSaga*
})
buildRootSaga
Optional function for custom root saga
(ducks, { refDucks, refErrorReporter }) => rootSaga*
-
ducks
are array of ducks -
refDucks.current
will hold current array of ducks. -
refErrorReporter.current
will hold current error reporter function.
buildRootSaga
default Default root saga will combine all duck root sagas (if exists) wrapped in try/catch restarting duck root saga in case of exception.
Use Pool Saga Stream
pool.addStream(PoolSagaStream())
Examples
https://github.com/hitosu/duckness/tree/master/stories
@Duckness packages:
- @duckness/duck - Modular Redux Ducks hatchery
- @duckness/saga - Redux Saga extension for @duckness/duck
- @duckness/epic - Redux-Observable extension for @duckness/duck
- @duckness/pool - @duckness/duck + Redux
- @duckness/pool-saga-stream - @duckness/saga plugin for @duckness/pool
- @duckness/pool-epic-stream - @duckness/epic plugin for @duckness/pool
- @duckness/react-redux-pool - @duckness/pool + React-Redux
- @duckness/use-redux - React hook for Redux store
- @duckness/use-pool - React hook for @duckness/pool.
- @duckness/store - simple store for React components
- @duckness/reactor - reactive data flow builder