npm

oker-limit
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

oker-limit

API

import { OkerQueue } from 'oker-limit';

const queue = new OkerQueue<number>();

queue.push(1);
queue.pop();
queue.clear();
queue.size;
const a = [...queue]; // [1]
import { OkerLimit } from 'oker-limit';

// The maximum concurrency limit is 10
const limit = OkerLimit(10);
const promises = [];

for (const item of list) {
    promises.push(
        limit(() => yourTask(item))
    );
}

await Promise.allSettled(limit);

Readme

Keywords

Package Sidebar

Install

npm i oker-limit

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.93 kB

Total Files

7

Last publish

Collaborators

  • fc1061393710