You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.9 KiB

2 years ago
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 };