Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ResourcePlugin<T>

Plugins are an extension to Strategies that allows to process cached data or fetch responses.

Type parameters

  • T

    type of the cached and fetched data.

Hierarchy

  • ResourcePlugin

Implemented by

Index

Properties

Optional cacheDidUpdate

cacheDidUpdate: undefined | ((param: CacheDidUpdateParam<T>) => Promise<void>)

Called during the cache writing stage.

Receives the old ResponseData (passed from the ResourceHandler), the new ResponseData (processed by the cacheWillUpdate), and the StorageRequest (processed by the cacheKeyWillBeUsed)

Optional cacheKeyWillBeUsed

cacheKeyWillBeUsed: undefined | ((param: CacheKeyWillBeUsedParam<T>) => Promise<StorageRequest>)

Called during the cache fetching and cache writing stage.

Receives the request from the ResourceHandler and allows to process and output a new StorageRequest.

Optional cacheWillUpdate

cacheWillUpdate: undefined | ((param: CacheWillUpdateParam<T>) => Promise<Optional<ResponseData<T>>>)

Called during the cache writing stage.

Receives the ResponseData to be cached and allows to process and output a new ResponseData to be cached, or null to prevent caching.

Also receives the newly processed StorageRequest from cacheKeyWillBeUsed.

Optional cachedResponseWillBeUsed

cachedResponseWillBeUsed: undefined | ((param: CachedResponseWillBeUsedParam<T>) => Promise<Optional<ResponseData<T>>>)

Called during the cache fetching stage.

Receives the processed StorageRequest from the cacheKeyWillBeUsed and allows to process and return a new ResponseData

Optional fetchDidFail

fetchDidFail: undefined | ((param: FetchDidFailParam<T>) => Promise<void>)

Called during the data fetching stage.

Receives the original request from the ResourceHandler and the processed request from the requestWillFetch and the error received from the fetcher failure.

Optional fetchDidSucceed

fetchDidSucceed: undefined | ((param: FetchDidSucceedParam<T>) => Promise<ResponseData<T>>)

Called during the data fetching stage.

Receives the original request from the ResourceHandler and the success response from the succeeding fetcher.

Optional requestWillFetch

requestWillFetch: undefined | ((param: RequestWillFetchParam<T>) => Promise<StorageRequest>)

Called during the data fetching stage.

Receives the parameters from the ResourceHandler and allows to process and output a new StorageRequest.

Generated using TypeDoc