No description
  • TypeScript 100%
Find a file
Mikkel ALMONTE--RINGAUD f064c03320
Some checks failed
Checks / checks (push) Failing after 30s
chore: release v1.1.0
2025-09-28 01:13:20 +02:00
.github/workflows chore(ci): upgrade versions 2025-09-27 22:49:40 +02:00
.vscode chore: add vscode configuration 2025-09-27 17:49:51 +02:00
examples chore!: rename to AsyncQueue 2025-09-28 01:12:13 +02:00
src refactor: remove lost of the useless logic 2025-09-28 01:12:00 +02:00
.gitignore chore: add tsup 2025-09-27 17:50:19 +02:00
bun.lock chore(pkg): prepare for release 2025-09-27 17:50:38 +02:00
eslint.config.ts fix: linter 2025-09-27 17:50:08 +02:00
LICENSE chore: add LICENSE 2025-09-27 22:50:37 +02:00
package.json chore: release v1.1.0 2025-09-28 01:13:20 +02:00
README.md docs: update size 2025-09-28 01:12:18 +02:00
tsconfig.json chore: add tsconfig 2025-09-27 17:50:27 +02:00
tsup.config.ts perf: use mangle on _ fields so # is not extra anymore 2025-09-28 01:11:06 +02:00

maqueue - Modern Asynchronous Queue

A dead-simple and lightweight (250B) queue for enqueuing asynchronous tasks with single concurrency.

Installation

Use any package manager you prefer.

bun add maqueue

Usage

Import and instantiate the queue using...

import { AsyncQueue } from "maqueue";
const queue = new AsyncQueue();

...finally, use run to perform an async task in the queue!

const p1 = queue.run(async () => {
  console.log("running 1");
  await wait(3000);
  return 1;
});

const p2 = queue.run(async () => {
  console.log("running 2");
  await wait(2000);
  return 2;
});

const p3 = queue.run(async () => {
  console.log("running 3");
  await wait(1000);
  return 3;
});

const outputs = await Promise.all([p1, p2, p3]);
console.log(outputs);
$ bun example.ts
running 1
running 2
running 3
[1, 2, 3]

See the whole file in examples/index.ts