Skip to main content
Module

x/mandarinets/mod.ts>PromiseRepeater

Mandarine.TS is a typescript, decorator-driven framework that allows you to create server-side applications. Mandarine.TS provides a range of built-in solutions such as Dependency Injection, Components, ORM and more. Under its umbrella, Mandarine.TS has 4 modules: Core, Data, Security and MVC, these modules will offer you the requirements to build a Mandarine-powered application.
Latest
class PromiseRepeater
import { PromiseRepeater } from "https://deno.land/x/mandarinets@v2.3.2/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();

Constructors

new
PromiseRepeater(promiseFunc: () => Promise<any>)

Properties

private
config
private
state

Methods

private
sleep(timeoutMs: number): Promise<void>
attempt(): Promise<any>
delay(delayBetweenAttemptsMs: number): PromiseRepeater
maxAttempts(attempts: number): PromiseRepeater
start(): Promise<any>