Skip to main content
Home

Built and signed on GitHub Actions

Run async and promise-returning functions with limited concurrency and optional rate limiting.

This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
100%
Published
a year ago (1.1.0)
interface IQueue

Interface for Queue class

Type Parameters

Properties

readonly
pending: number

Number of active items running now

readonly
waiting: number

Number of queued items waiting to run

readonly
length: number

Total number of active and queued items

Maximum number of active items running at once

Minimum number of milliseconds between start of each item

Methods

has(item: T): boolean

Returns true if item is in the waiting queue

get(item: T): Promise<R> | undefined

Returns the deferred promise for the item

Returns active items

Returns queued items

append(
item: T,
callback: QueueCallback<T, R>,
): Promise<R>

Append an item to the queue

prepend(
item: T,
callback: QueueCallback<T, R>,
): Promise<R>

Prepend an item to the queue

Returns true if item was removed from the waiting queue

sort(compare: (
a: T,
b: T,
) => number
): void

Prioritize the order of queued items

clear(): void

Clear the queue

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@dbushell/carriageway

Import symbol

import { type IQueue } from "@dbushell/carriageway";
or

Import directly with a jsr specifier

import { type IQueue } from "jsr:@dbushell/carriageway";

Add Package

pnpm i jsr:@dbushell/carriageway
or (using pnpm 10.8 or older)
pnpm dlx jsr add @dbushell/carriageway

Import symbol

import { type IQueue } from "@dbushell/carriageway";

Add Package

yarn add jsr:@dbushell/carriageway
or (using Yarn 4.8 or older)
yarn dlx jsr add @dbushell/carriageway

Import symbol

import { type IQueue } from "@dbushell/carriageway";

Add Package

vlt install jsr:@dbushell/carriageway

Import symbol

import { type IQueue } from "@dbushell/carriageway";

Add Package

npx jsr add @dbushell/carriageway

Import symbol

import { type IQueue } from "@dbushell/carriageway";

Add Package

bunx jsr add @dbushell/carriageway

Import symbol

import { type IQueue } from "@dbushell/carriageway";