Skip to content
On this page

Async

individual package can be found here @riadh-adrani/async-utils.


runAfter()

create a promise that will resolve after the given amount of time in milliseconds.

Uses setTimeout.

ts
function runAfter<T>(time: number, callback () => T): Promise<T | void>;
  • time : delay in milliseconds.
  • callback : callback to be executed.

throws when time is invalid.

throws when callback is not a function.

wait()

execute an asynchronous timeout.

Uses setTimeout.

ts
function wait<T>(time: number): Promise<void>;
  • time : delay in milliseconds.

Released under the MIT License.