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 that resolves after the specified wait period or the provided promise resolves, whichever comes first
Defined in
Last Updated: 08 January, 2020