The type of the successful result value
Function to poll that returns a PollActionResult indicating whether to continue waiting, succeed, error, timeout, or abort
Optional configuration:
Promise resolving to a PollerResult with state, statistics, and result/error/reason depending on the outcome
const result = await poller(async () => {
const status = await checkStatus();
if (status.ready) {
return { state: 'success', result: status.data };
}
return { state: 'waiting' };
}, { intervalMs: 2000, timeoutMs: 60000 });
if (result.state === 'success') {
console.log('Got result:', result.result);
}
Repeatedly polls an asynchronous function until a terminal state is reached.
The poller executes the provided function at regular intervals and supports: