Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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 delay(delayBetweenAttemptsMs: number): PromiseRepeater;
public maxAttempts(attempts: number): PromiseRepeater;
public start(): Promise<any>;
public unlimitedAttempts(): PromiseRepeater;
}

§Constructors

§
new PromiseRepeater(promiseFunc: () => Promise<any>)
[src]

§Properties

§
config
[src]
§
state
[src]

§Methods

§
sleep(timeoutMs: number): Promise<void> private
[src]
§
attempt(): Promise<any>
[src]
§
delay(delayBetweenAttemptsMs: number): PromiseRepeater
[src]
§
maxAttempts(attempts: number): PromiseRepeater
[src]
§
start(): Promise<any>
[src]
§
unlimitedAttempts(): PromiseRepeater
[src]