factorize
This commit is contained in:
parent
3056b42ace
commit
bfb92c513d
1 changed files with 2 additions and 7 deletions
|
@ -41,13 +41,8 @@ export function split_promise<T>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AsyncQueue<T> {
|
export class AsyncQueue<T> {
|
||||||
private items;
|
private items = [] as T[];
|
||||||
private awaiting;
|
private awaiting = [] as Consumer<void>[];
|
||||||
|
|
||||||
public constructor() {
|
|
||||||
this.items = [] as T[];
|
|
||||||
this.awaiting = [] as Consumer<void>[];
|
|
||||||
}
|
|
||||||
|
|
||||||
public push(item: T) {
|
public push(item: T) {
|
||||||
this.items.push(item);
|
this.items.push(item);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue