@duckness/pool-saga-stream
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@duckness/pool-saga-stream

@duckness/saga plugin for @duckness/pool

NPM License Libraries.io dependency status for latest release, scoped npm package GitHub issues vulnerabilities npm bundle size

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.

default buildRootSaga

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:

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    18
    • latest

Version History

Package Sidebar

Install

npm i @duckness/pool-saga-stream

Weekly Downloads

76

Version

1.0.0

License

MIT

Unpacked Size

17.4 kB

Total Files

6

Last publish

Collaborators

  • hitosu