🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

oker-limit

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oker-limit

JS队列 & 请求限制器

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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);

Keywords

limit

FAQs

Package last updated on 25 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts