UNPKG

@hyper-fetch/core

Version:

Cache, Queue and Persist your requests no matter if you are online or offline!

60 lines 7.66 kB
import { EventEmitter } from '../../utils'; /** * **Request Manager** is used to emit `request lifecycle events` like - request start, request end, upload and download progress. * It is also the place of `request aborting` system, here we store all the keys and controllers that are isolated for each client instance. */ export declare class RequestManager { emitter: EventEmitter; events: { emitDeduplicated: (data: import('..').RequestDeduplicatedEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitLoading: (data: import('..').RequestLoadingEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitRequestStart: (data: import('..').RequestEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitResponseStart: (data: import('..').RequestEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitUploadProgress: (data: import('..').RequestProgressEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitDownloadProgress: (data: import('..').RequestProgressEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitResponse: <Adapter extends import('../..').AdapterInstance>(data: import('..').RequestResponseEventType<import('../..').ExtendRequest<import('../..').RequestInstance, { client: import('../..').Client<any, Adapter>; }>>, isTriggeredExternally?: boolean) => void; emitAbort: (data: import('..').RequestEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; emitRemove: (data: import('..').RequestRemovedEventType<import('../..').RequestInstance>, isTriggeredExternally?: boolean) => void; onDeduplicated: <T extends import('../..').RequestInstance>(callback: (data: import('..').RequestDeduplicatedEventType<T>) => void) => VoidFunction; onDeduplicatedByQueue: <T extends import('../..').RequestInstance>(queryKey: string, callback: (data: import('..').RequestDeduplicatedEventType<T>) => void) => VoidFunction; onDeduplicatedByCache: <T extends import('../..').RequestInstance>(cacheKey: string, callback: (data: import('..').RequestDeduplicatedEventType<T>) => void) => VoidFunction; onDeduplicatedById: <T extends import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestDeduplicatedEventType<T>) => void) => VoidFunction; onLoading: <T extends import('../..').RequestInstance>(callback: (data: import('..').RequestLoadingEventType<T>) => void) => VoidFunction; onLoadingByQueue: <T extends import('../..').RequestInstance>(queryKey: string, callback: (data: import('..').RequestLoadingEventType<T>) => void) => VoidFunction; onLoadingByCache: <T extends import('../..').RequestInstance>(cacheKey: string, callback: (data: import('..').RequestLoadingEventType<T>) => void) => VoidFunction; onLoadingById: <T extends import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestLoadingEventType<T>) => void) => VoidFunction; onRequestStart: <T extends import('../..').RequestInstance>(callback: (details: import('..').RequestEventType<T>) => void) => VoidFunction; onRequestStartByQueue: <T extends import('../..').RequestInstance>(queryKey: string, callback: (details: import('..').RequestEventType<T>) => void) => VoidFunction; onRequestStartById: <T extends import('../..').RequestInstance>(requestId: string, callback: (details: import('..').RequestEventType<T>) => void) => VoidFunction; onResponseStart: <T extends import('../..').RequestInstance>(callback: (details: import('..').RequestEventType<T>) => void) => VoidFunction; onResponseStartByQueue: <T extends import('../..').RequestInstance>(queryKey: string, callback: (details: import('..').RequestEventType<T>) => void) => VoidFunction; onResponseStartById: <T extends import('../..').RequestInstance>(requestId: string, callback: (details: import('..').RequestEventType<T>) => void) => VoidFunction; onUploadProgress: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(callback: (data: import('..').RequestProgressEventType<T>) => void) => VoidFunction; onUploadProgressByQueue: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(queryKey: string, callback: (data: import('..').RequestProgressEventType<T>) => void) => VoidFunction; onUploadProgressById: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestProgressEventType<T>) => void) => VoidFunction; onDownloadProgress: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(callback: (data: import('..').RequestProgressEventType<T>) => void) => VoidFunction; onDownloadProgressByQueue: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(queryKey: string, callback: (data: import('..').RequestProgressEventType<T>) => void) => VoidFunction; onDownloadProgressById: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestProgressEventType<T>) => void) => VoidFunction; onResponse: <T extends import('../..').RequestInstance>(callback: (data: import('..').RequestResponseEventType<T>) => void) => VoidFunction; onResponseByCache: <T extends import('../..').RequestInstance>(cacheKey: string, callback: (data: import('..').RequestResponseEventType<T>) => void) => VoidFunction; onResponseById: <T extends import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestResponseEventType<T>) => void) => VoidFunction; onAbort: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(callback: (request: import('..').RequestEventType<T>) => void) => VoidFunction; onAbortByKey: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(abortKey: string, callback: (request: import('..').RequestEventType<T>) => void) => VoidFunction; onAbortById: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestEventType<T>) => void) => VoidFunction; onRemove: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(callback: (data: import('..').RequestRemovedEventType<T>) => void) => VoidFunction; onRemoveByQueue: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(queryKey: string, callback: (data: import('..').RequestRemovedEventType<T>) => void) => VoidFunction; onRemoveById: <T extends import('../..').RequestInstance = import('../..').RequestInstance>(requestId: string, callback: (data: import('..').RequestRemovedEventType<T>) => void) => VoidFunction; }; constructor(); abortControllers: Map<string, Map<string, AbortController>>; addAbortController: (abortKey: string, requestId: string) => void; getAbortController: (abortKey: string, requestId: string) => AbortController | undefined; removeAbortController: (abortKey: string, requestId: string) => void; useAbortController: (abortKey: string, requestId: string) => void; abortByKey: (abortKey: string) => void; abortByRequestId: (abortKey: string, requestId: string) => void; abortAll: () => void; } //# sourceMappingURL=request.manager.d.ts.map