Skip to main content
Version: Current

RequestManager


import { RequestManager } from "@hyper-fetch/core"

Description

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.

Defined in managers/request/request.manager.ts:9

Properties

abortControllers

Description

Defined in managers/request/request.manager.ts:13

Type

Map<string, Map<string, AbortController>>

emitter

Description

Defined in managers/request/request.manager.ts:10

Type

EventEmitter

events

Description

Defined in managers/request/request.manager.ts:11

Type

{ emitAbort: (abortKey: string, requestId: string, request: RequestInstance) => void; emitDownloadProgress: (queueKey: string, requestId: string, values: ProgressType, details: RequestEventType<RequestInstance>) => void; emitLoading: (queueKey: string, requestId: string, values: RequestLoadingEventType) => void; emitRemove: <T>(queueKey: string, requestId: string, details: RequestEventType<T>) => void; emitRequestStart: (queueKey: string, requestId: string, details: RequestEventType<RequestInstance>) => void; emitResponse: (cacheKey: string, requestId: string, response: ResponseType<unknown, unknown>, details: ResponseDetailsType) => void; emitResponseStart: (queueKey: string, requestId: string, details: RequestEventType<RequestInstance>) => void; emitUploadProgress: (queueKey: string, requestId: string, values: ProgressType, details: RequestEventType<RequestInstance>) => void; onAbort: (abortKey: string, callback: (request: RequestInstance) => void) => VoidFunction; onAbortById: (requestId: string, callback: (request: RequestInstance) => void) => VoidFunction; onDownloadProgress: <T>(queueKey: string, callback: (values: ProgressType, details: RequestEventType<T>) => void) => VoidFunction; onDownloadProgressById: <T>(requestId: string, callback: (values: ProgressType, details: RequestEventType<T>) => void) => VoidFunction; onLoading: (queueKey: string, callback: (values: RequestLoadingEventType) => void) => VoidFunction; onLoadingById: (requestId: string, callback: (values: RequestLoadingEventType) => void) => VoidFunction; onRemove: <T>(queueKey: string, callback: (details: RequestEventType<T>) => void) => VoidFunction; onRemoveById: <T>(requestId: string, callback: (details: RequestEventType<T>) => void) => VoidFunction; onRequestStart: <T>(queueKey: string, callback: (details: RequestEventType<T>) => void) => VoidFunction; onRequestStartById: <T>(requestId: string, callback: (details: RequestEventType<T>) => void) => VoidFunction; onResponse: <Response,ErrorType>(cacheKey: string, callback: (response: ResponseType<Response, ErrorType>, details: ResponseDetailsType) => void) => VoidFunction; onResponseById: <Response,ErrorType>(requestId: string, callback: (response: ResponseType<Response, ErrorType>, details: ResponseDetailsType) => void) => VoidFunction; onResponseStart: <T>(queueKey: string, callback: (details: RequestEventType<T>) => void) => VoidFunction; onResponseStartById: <T>(requestId: string, callback: (details: RequestEventType<T>) => void) => VoidFunction; onUploadProgress: <T>(queueKey: string, callback: (values: ProgressType, details: RequestEventType<T>) => void) => VoidFunction; onUploadProgressById: <T>(requestId: string, callback: (values: ProgressType, details: RequestEventType<T>) => void) => VoidFunction }

Methods

abortAll()

Preview

abortAll()

Description

Defined in managers/request/request.manager.ts:59

Return

void

abortByKey()

Preview

abortByKey(abortKey)

Description

Defined in managers/request/request.manager.ts:44

Parameters

NameDetails

abortKey

Required

string

Return

void

abortByRequestId()

Preview

abortByRequestId(abortKey, requestId)

Description

Defined in managers/request/request.manager.ts:55

Parameters

NameDetails

abortKey

Required

string

requestId

Required

string

Return

void

addAbortController()

Preview

addAbortController(abortKey, requestId)

Description

Defined in managers/request/request.manager.ts:15

Parameters

NameDetails

abortKey

Required

string

requestId

Required

string

Return

void

getAbortController()

Preview

getAbortController(abortKey, requestId)

Description

Defined in managers/request/request.manager.ts:29

Parameters

NameDetails

abortKey

Required

string

requestId

Required

string

Return

AbortController

removeAbortController()

Preview

removeAbortController(abortKey, requestId)

Description

Defined in managers/request/request.manager.ts:33

Parameters

NameDetails

abortKey

Required

string

requestId

Required

string

Return

void

useAbortController()

Preview

useAbortController(abortKey, requestId)

Description

Defined in managers/request/request.manager.ts:39

Parameters

NameDetails

abortKey

Required

string

requestId

Required

string

Return

void