qol improvements

This commit is contained in:
Vendicated 2022-11-03 19:12:50 +01:00
parent c20dc269d2
commit 2c3dee4120
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
3 changed files with 159 additions and 50 deletions

View file

@ -19,9 +19,9 @@
import { Promisable } from "type-fest";
export class Queue {
private promise = Promise.resolve();
private promise: Promise<any> = Promise.resolve();
add(func: () => Promisable<void>) {
this.promise = this.promise.then(func);
add<T>(func: (lastValue: unknown) => Promisable<T>): Promise<T> {
return (this.promise = this.promise.then(func));
}
}