race MethodStatic

Utility function to wait for either the specified time or a promise, whichever resolves first

race<T>(ms: number, promise: PromiseLike<T>): Promise<void | T>

@returns Promise that resolves after the specified wait period or the provided promise resolves, whichever comes first

Parameter Type Description
ms number Maximum duration in milliseconds to wait
promise PromiseLike<T> A pending promise to wait for

Returns - Promise<void | T>

Promise that resolves after the specified wait period or the provided promise resolves, whichever comes first

Defined in

Last Updated: 14 November, 2024