serwist
Version:
A Swiss Army knife for service workers.
81 lines • 3.11 kB
TypeScript
import type { RuntimeCaching } from "../types.js";
import type { PrecacheController } from "./PrecacheController.js";
import type { Router } from "./Router.js";
import type { FallbacksOptions } from "./fallbacks.js";
import { type HandlePrecachingOptions } from "./handlePrecaching.js";
import type { GoogleAnalyticsInitializeOptions } from "./initializeGoogleAnalytics.js";
/**
* Options for {@linkcode installSerwist}.
*
* @deprecated
*/
export interface InstallSerwistOptions extends Omit<HandlePrecachingOptions, "precacheController" | "router"> {
/**
* An optional {@linkcode PrecacheController} instance. If not provided, the singleton
* {@linkcode PrecacheController} will be used.
*/
precacheController?: PrecacheController;
/**
* An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
* will be used.
*/
router?: Router;
/**
* Forces the waiting service worker to become the active one.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting
*/
skipWaiting?: boolean;
/**
* Imports external scripts. They are executed in the order they
* are passed.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts
*/
importScripts?: string[];
/**
* Enables navigation preloading if it is supported.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/navigationPreload
*/
navigationPreload?: boolean;
/**
* Modifies the prefix of the default cache names used by Serwist packages.
*/
cacheId?: string | undefined;
/**
* Claims any currently available clients once the service worker
* becomes active. This is normally used in conjunction with `skipWaiting()`.
*
* @default false
*/
clientsClaim?: boolean;
/**
* A list of caching strategies.
*/
runtimeCaching?: RuntimeCaching[];
/**
* Your configuration for `@serwist/google-analytics`. This plugin is
* only initialized when this option is not `undefined` or `false`.
*/
offlineAnalyticsConfig?: GoogleAnalyticsInitializeOptions | boolean;
/**
* Disables Serwist's logging in development mode.
*
* @default false
*/
disableDevLogs?: boolean;
/**
* Precaches routes so that they can be used as a fallback when
* a Strategy fails to generate a response.
*/
fallbacks?: Pick<FallbacksOptions, "entries">;
}
/**
* Abstracts away the core APIs of Serwist.
*
* @param options - `installSerwist` options.
* @deprecated
*/
export declare const installSerwist: ({ precacheController, router, precacheEntries, precacheOptions, cleanupOutdatedCaches, navigateFallback, navigateFallbackAllowlist, navigateFallbackDenylist, skipWaiting, importScripts, navigationPreload, cacheId, clientsClaim, runtimeCaching, offlineAnalyticsConfig, disableDevLogs, fallbacks, }: InstallSerwistOptions) => void;
//# sourceMappingURL=installSerwist.d.ts.map