0.2.0 • Published 5 years ago

redux-saga-job-queue v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

redux-saga-job-queue

Queue same redux saga tasks and run them in a batch.

Install

Library is written for ES modules

npm install redux-saga-job-queue

Usage

Lets assume that you already have it installed. First we import it.

import { createInteractiveQueue } from 'redux-saga-job-queue';

Second, we need to define a task that is going to be called for each item.

function downloadFile({ payload }) {
  const payload = yield call(fetch, payload);
  yield put({
    type: 'FILE_READY',
    payload,
  });
}

Run the jobs in three parallel threads

function* downloadFiles(files) {
  const queue = createInteractiveQueue({
    items: files,
    jobFactory: downloadFile,
    concurrency: 3,
  });
  yield call(queue.run);
}
0.2.0

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago