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<T | void>

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

Returns - Promise<T | void>

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

Defined in

Last Updated: 15 June, 2021