Type of request headers
Type of request params
Type of instance state
Type of response headers
Create a new FetchEngine instance.
Type of request headers
Type of request params
Type of instance state
Type of response headers
Configuration options
ReadonlyconfigOptions store for accessing all configuration.
ReadonlyheadersHeaders manager for adding/removing/resolving headers.
ReadonlyhooksHook engine for the request lifecycle pipeline.
Register hooks to intercept, modify, or short-circuit requests. Plugins install their hooks here at negative priorities so user hooks at priority 0 run after built-in policies.
ReadonlyparamsParams manager for adding/removing/resolving URL parameters.
ReadonlystateState store for managing instance state.
StaticuseSymbol to use the default value or configuration.
When returned from determineType, uses built-in content-type detection.
Property store for headers (FetchEngineCore compliance).
Property store for params (FetchEngineCore compliance).
Returns if the observable instance has the given event
The internals of the observable instance.
NOTE: Do not use this to try to meddle with the internals of the observable instance. This is for debugging purposes only.
Get cache statistics.
Clear all cached responses.
Clear a specific cache entry.
Enables or disables debugging for the observable instance. Works in conjunction with your spy function. Provides a stack trace of events that are triggered, listened to, and cleaned up.
Optionalon: booleanWhether to enable or disable debugging
Makes a DELETE request to remove a resource.
Optionalpayload: DataOptionaloptions: CallConfig<H, P, InstanceState>Destroy the FetchEngine instance.
Aborts all pending requests and cleans up resources. After calling destroy(), the instance cannot be used.
Makes a GET request to retrieve data.
Optionaloptions: CallConfig<H, P, InstanceState>Makes an HTTP HEAD request to retrieve headers only.
Optionalopts: CallConfig<H, P, InstanceState>Invalidate cache entries matching a predicate.
Check if the engine has been destroyed.
Returns an event generator that will listen for the specified event
Optionaloptions: ListenerOptionsReturns an event generator that will listen for the specified event
Optionaloptions: ListenerOptionsListens for the specified event and executes the given callback
Optionaloptions: ListenerOptionsReturns an event generator that will listen for the specified event
Optionaloptions: ListenerOptionsReturns an event generator that will listen for all events matching the regex
Optionaloptions: ListenerOptionsListens for all events matching the regex and executes the given callback
Optionaloptions: ListenerOptionsReturns an event promise that resolves when the specified event is emitted. This overload is untyped and can be used to listen for any event that is emitted.
Optionaloptions: ListenerOptionsExecutes a callback once when the specified event is emitted. This overload is untyped and can be used to listen for any event that is emitted.
Optionaloptions: ListenerOptionsReturns an event promise that resolves when any events matching the regex are emitted
Optionaloptions: ListenerOptionsExecutes a callback once when any events matching the regex are emitted
Optionaloptions: ListenerOptionsMakes an HTTP OPTIONS request to check server capabilities.
Optionalopts: CallConfig<H, P, InstanceState>Makes a PATCH request to partially update a resource.
Optionalpayload: DataOptionaloptions: CallConfig<H, P, InstanceState>Makes a POST request to create a new resource.
Optionalpayload: DataOptionaloptions: CallConfig<H, P, InstanceState>Makes a PUT request to replace a resource.
Optionalpayload: DataOptionaloptions: CallConfig<H, P, InstanceState>Makes an HTTP request with the specified method.
Optionaloptions: CallConfig<H, P, InstanceState> & { payload?: Data }Install a plugin at runtime.
The plugin's install() method is called with this engine instance.
Returns an unsubscribe function that removes the plugin's hooks.
Plugin to install
Cleanup function to uninstall the plugin
StaticcopyCopies all matching listeners from source to target without removing them from the source. Target's existing listeners are preserved.
Useful when forking an engine so both instances react to the same events independently.
Optionaloptions: TransferOptions<Shape>StatictransferTransfers all matching listeners from source to target, removing them from the source. Target's existing listeners are preserved.
Useful when cloning an engine (e.g. FetchEngine) and carrying over observability listeners to the new instance.
Optionaloptions: TransferOptions<Shape>
Creates a wrapper around
fetchwith configurable defaults, retry logic, request deduplication, caching, and rate limiting.Provides resilient HTTP client for production applications that need reliable API communication with comprehensive error handling.
Example
Example