@snap/camera-kit
Version:
Camera Kit Web
15 lines • 1.1 kB
TypeScript
import type { Persistence } from "../persistence/Persistence";
import type { ChainableHandler, RequestMetadata } from "./HandlerChainBuilder";
/**
* This handler persists in-flight requests locally, so that if there is an unexpected termination of the process (e.g.
* the browser tab crashes or is closed) those requests can be recovered and retried on the next page load.
*
* Keep in mind, using this handler means some *successful* requests may be repeated (e.g. if the request made it to a
* server, which responded, but the response didn't reach the browser before the tab closed). Any handler chain making
* use of this handler should only handle idempotent requests.
*
* @param persistence Requests will be temporarily stored here while they are in-flight.
* @returns {@link ChainableHandler}, suitable for use in {@link HandlerChainBuilder.map}
*/
export declare const createPersistingHandler: <Req, Res, Meta extends RequestMetadata>(persistence: Persistence<[Req, Meta | undefined]>) => ChainableHandler<Req, Res, Req, Res, Meta>;
//# sourceMappingURL=persistingHandler.d.ts.map