UNPKG

flechette

Version:

A highly configurable wrapper for Fetch API that supports programmatic retries and completely obfuscates promise handling.

12 lines (11 loc) 1.49 kB
import { FlechetteController, FlechetteResponse, NetResponse, ResponseFunc, SendArgs, ToggleFunc } from "./flechette"; export declare type SendAndEvalFunc = (args: SendArgs | Array<SendArgs>, successFunc: ResponseFunc, failureFunc: ResponseFunc, waitingFunc?: ToggleFunc) => void; export declare const send: (args: SendArgs | SendArgs[], successFunc: ResponseFunc, failureFunc: ResponseFunc, waitingFunc?: ToggleFunc | undefined) => void; export declare const initialArgSetup: (flechetteInstance: FlechetteController, args: SendArgs) => void; export declare const sendRetryOrAbort: (args: SendArgs | SendArgs[], timeout: number | undefined, maxRetryCount: number, abortFunc: () => void, sendAndEvalFunc: SendAndEvalFunc, successFunc: ResponseFunc, failureFunc: ResponseFunc, waitingFunc?: ToggleFunc | undefined) => void; export declare const sendAndEvaluate: SendAndEvalFunc; export declare const sendAndEvaluateMultiple: SendAndEvalFunc; export declare const retry: (response: FlechetteResponse, flechetteInstance: FlechetteController, successFunc: ResponseFunc, failureFunc: ResponseFunc, waitingFunc?: ToggleFunc | undefined) => boolean; export declare const retryMultiple: (responses: FlechetteResponse[], successFunc: ResponseFunc, failureFunc: ResponseFunc, waitingFunc?: ToggleFunc | undefined) => boolean; export declare const evaluateResponse: (resp: NetResponse, f: FlechetteController) => FlechetteResponse; export declare const fetchWrap: (args: SendArgs) => Promise<NetResponse>;