PluginMethods
Import
import { PluginMethods } from "@hyper-fetch/core"
Source
Package
Preview
type PluginMethods<Client> = {
onAdapterFetch?: (data: { adapter: AdapterInstance; request: RequestInstance; requestId: string }) => void;
onCacheItemChange?: <Requests>(data: { cache: Cache<ExtractClientAdapterType<Client>>; cacheKey: Requests[cacheKey]; newData: CacheValueType<Requests[response], Requests[error], ExtractClientAdapterType<Client>>; prevData: CacheValueType<Requests[response], Requests[error], ExtractClientAdapterType<Client>> | null }) => void;
onCacheItemDelete?: (data: { cache: Cache<ExtractClientAdapterType<Client>>; cacheKey: string }) => void;
onCacheItemInvalidate?: (data: { cache: Cache<ExtractClientAdapterType<Client>>; cacheKey: string }) => void;
onDispatcherCleared?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>> }) => void;
onDispatcherItemAdded?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>>; queue: QueueDataType<ExtendRequest<RequestInstance, { client: Client }>>; queueItem: ResolvedQueueItemType<ExtendRequest<RequestInstance, { client: Client }>> }) => void;
onDispatcherItemDeleted?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>>; queue: QueueDataType<ExtendRequest<RequestInstance, { client: Client }>>; queueItem: ResolvedQueueItemType<ExtendRequest<RequestInstance, { client: Client }>> }) => void;
onDispatcherQueueCleared?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>>; queue: QueueDataType<ExtendRequest<RequestInstance, { client: Client }>> }) => void;
onDispatcherQueueCreated?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>>; queue: QueueDataType<ExtendRequest<RequestInstance, { client: Client }>> }) => void;
onDispatcherQueueDrained?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>>; queue: QueueDataType<ExtendRequest<RequestInstance, { client: Client }>> }) => void;
onDispatcherQueueRunning?: (data: { dispatcher: Dispatcher<ExtractClientAdapterType<Client>>; queue: QueueDataType<ExtendRequest<RequestInstance, { client: Client }>>; status: paused | stopped | running }) => void;
onMount?: (data: { client: Client }) => void;
onRequestCreate?: (data: { request: PluginRequest<Client> }) => void;
onRequestError?: (data: { request: PluginRequest<Client>; response: ResponseErrorType<ExtractErrorType<PluginRequest<Client>>, ExtractAdapterType<PluginRequest<Client>>> }) => void;
onRequestFinished?: (data: { request: PluginRequest<Client>; response: ResponseType<ExtractResponseType<PluginRequest<Client>>, ExtractErrorType<PluginRequest<Client>>, ExtractAdapterType<PluginRequest<Client>>> }) => void;
onRequestStart?: (data: { request: PluginRequest<Client> }) => void;
onRequestSuccess?: (data: { request: PluginRequest<Client>; response: ResponseSuccessType<ExtractResponseType<PluginRequest<Client>>, ExtractAdapterType<PluginRequest<Client>>> }) => void;
onRequestTrigger?: (data: { request: PluginRequest<Client> }) => void;
onUnmount?: (data: { client: Client }) => void;
}
Structure
PluginMethods
| Name | Type | Description |
|---|---|---|
| onAdapterFetch | | |
| onCacheItemChange | | |
| onCacheItemDelete | | |
| onCacheItemInvalidate | | |
| onDispatcherCleared | | |
| onDispatcherItemAdded | | |
| onDispatcherItemDeleted | | |
| onDispatcherQueueCleared | | |
| onDispatcherQueueCreated | | |
| onDispatcherQueueDrained | | |
| onDispatcherQueueRunning | | |
| onMount | | |
| onRequestCreate | | |
| onRequestError | | |
| onRequestFinished | | |
| onRequestStart | | |
| onRequestSuccess | | |
| onRequestTrigger | | |
| onUnmount | |
