PromiseRepeater
import { PromiseRepeater } from "https://raw.githubusercontent.com/mandarineorg/mandarinets/master/mod.ts";
This class serves a promise repeater which will re-try your promise until they are successfully resolved or the max attempt limit has been reached.
await new PromiseRepeater(promiseFunc).maxAttempts(5).start();
await new PromiseRepeater(promiseFunc).maxAttempts(5).delay(1000).start();
await new PromiseRepeater(promiseFunc).unlimitedAttempts().delay(1000).start();
class PromiseRepeater { }
constructor(promiseFunc: () => Promise<any>);
private config;
private state;
private sleep(timeoutMs: number): Promise<void>;
public async attempt(): Promise<any>;
public start(): Promise<any>;
§Properties
§Methods
§
delay(delayBetweenAttemptsMs: number): PromiseRepeater
[src]§
maxAttempts(attempts: number): PromiseRepeater
[src]§
unlimitedAttempts(): PromiseRepeater
[src]