Urara-Blog/node_modules/.pnpm-store/v3/files/00/d186f8dcf88d26721b25b5728c0d61769b608f8f93ea399b6fe6151d624123f43fec29e6209fc6d5c6e3af8feb2248be37cd2b187f20c3375285404fc76864
2022-08-14 01:14:53 +08:00

43 lines
1.9 KiB
Text

import { Strategy, StrategyOptions } from './Strategy.js';
import { StrategyHandler } from './StrategyHandler.js';
import './_version.js';
interface NetworkOnlyOptions extends Omit<StrategyOptions, 'cacheName' | 'matchOptions'> {
networkTimeoutSeconds?: number;
}
/**
* An implementation of a
* [network-only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only)
* request strategy.
*
* This class is useful if you want to take advantage of any
* [Workbox plugins](https://developer.chrome.com/docs/workbox/using-plugins/).
*
* If the network request fails, this will throw a `WorkboxError` exception.
*
* @extends workbox-strategies.Strategy
* @memberof workbox-strategies
*/
declare class NetworkOnly extends Strategy {
private readonly _networkTimeoutSeconds;
/**
* @param {Object} [options]
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
* to use in conjunction with this caching strategy.
* @param {Object} [options.fetchOptions] Values passed along to the
* [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)
* of [non-navigation](https://github.com/GoogleChrome/workbox/issues/1796)
* `fetch()` requests made by this strategy.
* @param {number} [options.networkTimeoutSeconds] If set, any network requests
* that fail to respond within the timeout will result in a network error.
*/
constructor(options?: NetworkOnlyOptions);
/**
* @private
* @param {Request|string} request A request to run this strategy for.
* @param {workbox-strategies.StrategyHandler} handler The event that
* triggered the request.
* @return {Promise<Response>}
*/
_handle(request: Request, handler: StrategyHandler): Promise<Response>;
}
export { NetworkOnly, NetworkOnlyOptions };