@itwin/core-bentley
Version:
Bentley JavaScript core components
17 lines • 1.1 kB
TypeScript
/** @packageDocumentation
* @module Utils
*/
/**
* Wrapper function designed to be used for callbacks called by setInterval or setTimeout in order to propagate any
* exceptions thrown in the callback to the main promise chain. It does this by creating a new promise for the callback
* invocation and adding it to the timerPromises set. The main promise chain can then await
* Promise.all(timerPromises) to catch any exceptions thrown in any of the callbacks. Note that if the callback
* completes successfully, the promise is resolved and removed from the set. If it throws an exception, the promise is
* rejected but not removed from the set, so that the main promise chain can detect that an error occurred and handle
* it appropriately.
* @param timerPromises A set of promises representing the currently active timer callbacks.
* @param callback The async callback to be executed within the timer.
* @beta
*/
export declare function wrapTimerCallback(timerPromises: Set<Promise<void>>, callback: () => Promise<void>): Promise<void>;
//# sourceMappingURL=UtilityFunctions.d.ts.map