A simple wrapper around setTimeout because I like awaitables and I hate rewriting the exact same wrapper for every time.
Callback style
function test(): void {
Timer.for(Duration.fromSeconds(10))
.addCallback(() => console.log("10 seconds later!"))
.addCallback(doSomething)
.start();
}
Awaitable style
async function test(): Promise<void> {
await Timer.for(Duration.fromSeconds(10)).start().asAwaitable();
console.log("10 seconds later!");
}
Or shortcut awaitable
async function test(): Promise<void> {
await Timer.immediateAwaitable(Duration.fromSeconds(10));
console.log("10 seconds later!");
}