1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export declare class AsyncStack<T> {
|
11 | private _available;
|
12 | private _pending;
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 | constructor(iterable?: Iterable<T | PromiseLike<T>>);
|
19 | /**
|
20 | * Gets the number of entries in the stack.
|
21 | * When positive, indicates the number of entries available to get.
|
22 | * When negative, indicates the number of requests waiting to be fulfilled.
|
23 | */
|
24 | get size(): number;
|
25 | /**
|
26 | * Adds a value to the top of the stack. If the stack is empty but has a pending
|
27 | * pop request, the value will be popped and the request fulfilled.
|
28 | *
|
29 | * @param value A value or promise to add to the stack.
|
30 | */
|
31 | push(value: T | PromiseLike<T>): void;
|
32 | /**
|
33 | * Removes and returns a Promise for the top value of the stack. If the stack is empty,
|
34 | * returns a Promise for the next value to be pushed on to the stack.
|
35 | */
|
36 | pop(): Promise<T>;
|
37 | }
|