1.0.5 • Published 5 years ago

redux-saga-caller v1.0.5

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

Redux Saga Caller - Call Sagas Once Per Params

Easy way how to prevent calling Redux Sagas twice with same params in parallel.

Once saga with same parameter finish, library will stop ignoring new requests.

Tiny library - only 1KB minified!

Note: Require redux-saga dependency installed in your project.

Usage API

Install npm i redux-saga-caller

callOncePerParams(customIdentifier, sagaFunctionWithParams)

...having:

  • identifier: string / array of string to uniquely identify your action
  • sagaFunctionWithParams: array with saga function name and it's params (same as official saga call params)

To get all running tasks identifiers (JavaScript Set) use method getRunning.

Example

import { callOncePerParams } from 'redux-saga-caller';

// Somewhere in your Redux Saga...

yield callOncePerParams(
  ['FETCH_ARTICLES', 'ASC', 10],
  [fetchArticlesSaga, { order: 'ASC', limit: 10}]
);

See and run src/index.test.js to fully understand library.

Enjoy :relaxed:

Please give project :star: if you like it!

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago