-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.d.ts
51 lines (44 loc) · 1.52 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export default class FlatQueue<T> {
/**
* Number of items in the queue.
*/
readonly length: number;
constructor();
/**
* Removes all items from the queue.
*/
clear(): void;
/**
* Adds `item` to the queue with the specified `priority`.
*
* `priority` must be a number. Items are sorted and returned from low to
* high priority. Multiple items with the same priority value can be added
* to the queue, but there is no guaranteed order between these items.
*/
push(item: T, priority: number): void;
/**
* Removes and returns the item from the head of this queue, which is one of
* the items with the lowest priority. If this queue is empty, returns
* `undefined`.
*/
pop(): T | undefined;
/**
* Returns the item from the head of this queue without removing it. If this
* queue is empty, returns `undefined`.
*/
peek(): T | undefined;
/**
* Returns the priority value of the item at the head of this queue without
* removing it. If this queue is empty, returns `undefined`.
*/
peekValue(): number | undefined;
/**
* Shrinks the internal arrays to `this.length`.
*
* `pop()` and `clear()` calls don't free memory automatically to avoid
* unnecessary resize operations. This also means that items that have been
* added to the queue can't be garbage collected until a new item is pushed
* in their place, or this method is called.
*/
shrink(): void;
}