@sapphire/utilities
Version:
Common JavaScript utilities for the Sapphire Community
23 lines (21 loc) • 807 B
text/typescript
interface SleepOptions {
/**
* When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
*/
signal?: AbortSignal | undefined;
/**
* Set to `false` to indicate that the scheduled `Timeout`
* should not require the Node.js event loop to remain active.
* @default true
*/
ref?: boolean | undefined;
}
/**
* Sleeps for the specified number of milliseconds.
* For a synchronous variant, see [sleepSync](./sleepSync.d.ts).
* @param ms The number of milliseconds to sleep.
* @param value A value with which the promise is fulfilled.
* @see {@link sleepSync} for a synchronous version.
*/
declare function sleep<T = undefined>(ms: number, value?: T, options?: SleepOptions): Promise<T>;
export { type SleepOptions, sleep };