Module: util/queue

A simple singly linked list based queue implementation for arbitrary data. This utility module can be used by anyone, there is nothing specific to ONE.core in it.

Source:

Methods

(static) createSimpleQueue() → {SimpleQueue}

Creates a queue instance that uses a singly linked list

Source:
Returns:

Returns an API-object for a simple queue

Type: SimpleQueue

Type Definitions

SimpleQueue

A simple general queue implementation using a singly linked list which accepts any data, as long as it is a single item. Note that none of the API functions need to be bound (they don't use this). See util/queue.ts

Type:
  • object
Properties:
Name Type Description
enqueue function

(T) => void — Add to the head of the queue

enqueueN function

(T[]) => void — Add n values at once

dequeue function

() => T — Return the oldest entry and remove it from the queue

dequeueN function

(number) => T[] — Return n queue items at once

size function

() => number — Size of the queue

isEmpty function

() => booleantrue if the queue is empty, false if not

clear function

() => void — Removes all elements from this queue

Source: