serwist
Version:
A Swiss Army knife for service workers.
32 lines • 1.23 kB
TypeScript
import type { StrategyOptions } from "./Strategy.js";
import { Strategy } from "./Strategy.js";
import type { StrategyHandler } from "./StrategyHandler.js";
export interface NetworkOnlyOptions extends Omit<StrategyOptions, "cacheName" | "matchOptions"> {
/**
* If set, any network requests that fail to respond within the timeout will result in a network error.
*/
networkTimeoutSeconds?: number;
}
/**
* An implementation of the [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network_only)
* request strategy.
*
* This class is useful if you require specific requests to only be fulfilled from the network.
*
* If the network request fails, this will throw a {@linkcode SerwistError} exception.
*/
export declare class NetworkOnly extends Strategy {
private readonly _networkTimeoutSeconds;
/**
* @param options
*/
constructor(options?: NetworkOnlyOptions);
/**
* @private
* @param request A request to run this strategy for.
* @param handler The event that triggered the request.
* @returns
*/
_handle(request: Request, handler: StrategyHandler): Promise<Response>;
}
//# sourceMappingURL=NetworkOnly.d.ts.map