mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 01:45:15 +00:00
47 lines
2.0 KiB
TypeScript
47 lines
2.0 KiB
TypeScript
import { RouteHandlerObject, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js';
|
|
import './_version.js';
|
|
interface NetworkFirstOptions {
|
|
plugins?: WorkboxPlugin[];
|
|
fetchOptions?: RequestInit;
|
|
}
|
|
/**
|
|
* An implementation of a
|
|
* [network-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-only}
|
|
* request strategy.
|
|
*
|
|
* This class is useful if you want to take advantage of any
|
|
* [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.
|
|
*
|
|
* If the network request fails, this will throw a `WorkboxError` exception.
|
|
*
|
|
* @memberof module:workbox-strategies
|
|
*/
|
|
declare class NetworkOnly implements RouteHandlerObject {
|
|
private readonly _plugins;
|
|
private readonly _fetchOptions?;
|
|
/**
|
|
* @param {Object} options
|
|
* @param {string} options.cacheName Cache name to store and retrieve
|
|
* requests. Defaults to cache names provided by
|
|
* [workbox-core]{@link module:workbox-core.cacheNames}.
|
|
* @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 all fetch() requests made by this strategy.
|
|
*/
|
|
constructor(options?: NetworkFirstOptions);
|
|
/**
|
|
* This method will perform a request strategy and follows an API that
|
|
* will work with the
|
|
* [Workbox Router]{@link module:workbox-routing.Router}.
|
|
*
|
|
* @param {Object} options
|
|
* @param {Request|string} options.request The request to run this strategy for.
|
|
* @param {Event} [options.event] The event that triggered the request.
|
|
* @return {Promise<Response>}
|
|
*/
|
|
handle({ event, request }: RouteHandlerCallbackOptions): Promise<Response>;
|
|
}
|
|
export { NetworkOnly };
|