Constructor
new ObservableQueue()
An observable Queue (Fifo)
- Since
- 3.3.0
- Copyright
- schukai GmbH
- License
- AGPLv3
Example
import {Queue} from '@schukai/monster/source/types/queue.mjs';
const queue = new Queue;
queue.add(2);
queue.add(true);
queue.add("Hello");
queue.add(4.5);
console.log(queue.poll());
// ↦ 2
console.log(queue.poll());
// ↦ true
console.log(queue.poll());
// ↦ "Hello"
console.log(queue.poll());
// ↦ 4.5
console.log(queue.poll());
// ↦ undefined
Members
(static) instanceSymbol
This method is called by the
instanceof
operator.This method is called by the instanceof
operator.
- Since
- 2.1.0
Methods
add(value) → {Queue}
Add a new element to the end of the queue.
Add a new element to the end of the queue.
Parameters:
Name | Type | Description |
---|---|---|
value | * |
Returns:
- Type:
- Queue
attachObserver(observer) → {ProxyObserver}
Attach a new observer
.Attach a new observer
Parameters:
Name | Type | Description |
---|---|---|
observer | Observer |
Returns:
- Type:
- ProxyObserver
clear() → {Queue}
remove all entries
.remove all entries
Returns:
- Type:
- Queue
containsObserver(observer) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
observer | Observer |
Returns:
- Type:
- boolean
detachObserver(observer) → {ProxyObserver}
Detach a observer
.Detach a observer
Parameters:
Name | Type | Description |
---|---|---|
observer | Observer |
Returns:
- Type:
- ProxyObserver
notifyObservers() → {Promise}
Notify all observer
.Notify all observer
Returns:
- Type:
- Promise