Home Reference Source Repository
import Queue from 'wal/src/queue.js'
public class | source

Queue

A simple queue class.

This is an obvious es6 dirivative of Stephen Morley's queue implementation.

Constructor Summary

Public Constructor
public

Creates a new instance.

Member Summary

Public Members
public get
public get

Method Summary

Public Methods
public

dequeue(): *

Dequeues the item at the head of the queue, removing the item.

public

enqueue(item: *)

Enqueues the specified item.

public

peek(): *

Peeks at the item at the head of the queue without removing it.

Public Constructors

public constructor source

Creates a new instance.

Public Members

public get isEmpty: boolean source

public get length: number source

Public Methods

public dequeue(): * source

Dequeues the item at the head of the queue, removing the item.

Return:

*

The item at the head of the queue or undefined if the queue is empty.

public enqueue(item: *) source

Enqueues the specified item.

Params:

NameTypeAttributeDescription
item *

An item to put on the queue.

public peek(): * source

Peeks at the item at the head of the queue without removing it.

Return:

*

The item at the head of the queue or undefined if the queue is empty.