UNPKG

anux-common

Version:

[![Build Status](https://travis-ci.com/Anupheaus/anux-common.svg?branch=master)](https://travis-ci.com/Anupheaus/anux-common) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/dd0e0bd3a96247a5a78c02a812f949f8)](https://www.codacy.com/app/Anuphea

15 lines (14 loc) 528 B
interface ICommonConfig<T> { onFailure?(error: Error): T; onSuccess?(result: T, attempts: number): T | void; } interface IConfigMaxAttempts { maxAttempts: number; onAttempt?(attempt: number, error: Error): boolean | void; } interface IConfigOnAttempt { onAttempt(attempt: number, error: Error): boolean | void; } declare type IConfig<T> = ICommonConfig<T> & (IConfigMaxAttempts | IConfigOnAttempt); export declare function repeatOnError<T>(delegate: () => T, config: IConfig<T>): T; export {};