JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q30695F
  • License MIT

Quickly Create Sagas to transform your actions to other actions and more.

Package Exports

  • @redux-actionlang/sagas

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@redux-actionlang/sagas) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@redux-actionlang/sagas

Quickly Create Sagas to transform your actions to other actions and more.

The Setup

import SagaGenerator from '@redux-actionlang/sagas';
import SagaMiddleware from 'redux-saga';

const SagaGenerator = new SagaGenerator();

createSagaMiddleware().run(SagaGenerator.create());

The Usage

filter operator
  • Used to filter some actions so that you can apply map to filtered actions only.
  • Every Action will still go through reducer.
SagaGenerator.filter(action => action.type === 'MY_TYPE');
map operator
  • Apply a function on every action or every filtered action if filtered is used before.
SagaGenerator.map((action, { put }) => action);
create
  • Create a saga to be used in Saga Middleware.
SagaGenerator.create();

Examples

  • A Simple Logger

Will log every action dispatched to the reducer.

SagaGenerator
.map(action => console.log(action))
.create();
  • Dispatch an action in response to another action.
SagaGenerator
.filter(action => action.type === 'MY_TYPE')
.map((action, { put }) => put('YOUR_TYPE'))
.create();