Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/fifo/lib/fifo.ts>default

First-in-first-out queue
Latest
class default
import { default } from "https://deno.land/x/fifo@v0.2.4/lib/fifo.ts";

First-in-first-out queue.

Constructors

new
default(capacity?: number)

Creates a new FIFO queue with the given (initial) capacity.

Properties

private
head: StaticFIFO<T>
private
optional
resolve: (value: T) => void
private
tail: StaticFIFO<T>
length: number

The length of the queue.

Methods

Clears the queue.

peek(): T | undefined

Peeks at the next value in the queue.

push(value: T)

Pushes a new value to the queue.

shift(): T | undefined

Shifts a value from the queue.

[Symbol.asyncIterator](): AsyncGenerator<T>

Returns an async iterator for the queue.

[Symbol.iterator](): Generator<T>

Returns an iterator for the queue.