@gamestdio/timer
Advanced tools
Changelog
1.4.0
9975b29: Add a new async scheduling function duration
for usage with async functions.
Inside an async function
const timer = new Clock(true);
await timer.duration(1000);
console.log("1 second later");
Using the promise
const timer = new Clock(true);
timer.duration(1000).then(() => console.log("1 second later"));
Using the promise with error
const timer = new Clock(true);
timer
.duration(1000)
.then(() => console.log("1 second later"))
.catch(() => console.log("Timer cleared"));
timer.clear();