
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
easy-promise-queue
Advanced tools
An easy JavaScript Promise queue which is automatically executed, concurrency controlled and suspendable.
Easy promise queue. Set a concurrency to execute promises in the queue.
English 中文
It's a concurrent queue which can pause.
When its concurrency is set as 1(by default), it's a FIFO queue.
You can put Promises into this queue. Only X promises can be executed concurrently as your configuration.
You can pause/resume this queue at any time. When the queue is paused, ongoing promises will keep running until done though.
$ npm install easy-promise-queue
commonJS:
const PromiseQueue = require("easy-promise-queue").default;
es2015:
import PromiseQueue from 'easy-promise-queue';
let pq = new PromiseQueue({concurrency: 1});
pq.add(() => {
return new Promise(function (resolve, reject) {
setTimeout(function () {
console.log('task 1');
resolve();
}, 1000)
});
});
pq.add(() => {
return new Promise(function (resolve, reject) {
setTimeout(function () {
console.log('task 2');
resolve();
}, 1000)
});
});
// syntax sugar:
pq.add([promiseThunk, promiseThunk, promiseThunk]);
// is equal to:
pq.add(promiseThunk).add(promiseThunk).add(promiseThunk);
// is equal to:
pq.add(promiseThunk);
pq.add(promiseThunk);
pq.add(promiseThunk);
//The added promises will be executed one by one.
...
pq.pause();
// you can still add promise, however none of them will run.
pq.resume();
// Promises will resume to run.
FAQs
An easy JavaScript Promise queue which is automatically executed, concurrency controlled and suspendable.
The npm package easy-promise-queue receives a total of 3,272 weekly downloads. As such, easy-promise-queue popularity was classified as popular.
We found that easy-promise-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.