Installation
npm install --save @types/sw-precache
Summary
This package contains type definitions for sw-precache (https://github.com/googlechrome/sw-precache).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sw-precache.
index.d.ts
// Type definitions for sw-precache 5.2
// Project: https://github.com/googlechrome/sw-precache
// Definitions by: JounQin <https://github.com/JounQin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import {
Handler as SwToolboxHanlder,
Options as SwToolboxOptions,
} from 'sw-toolbox';
export type Handler =
| 'networkFirst'
| 'cacheFirst'
| 'fastest'
| 'cacheOnly'
| 'networkOnly'
| SwToolboxHanlder;
export type Method = 'get' | 'post' | 'put' | 'delete' | 'head';
export interface Options {
cacheId?: string | undefined;
clientsClaim?: boolean | undefined;
directoryIndex?: string | undefined;
dontCacheBustUrlsMatching?: RegExp | undefined;
dynamicUrlToDependencies?: {
[url: string]: string | Buffer | string[];
} | undefined;
handleFetch?: boolean | undefined;
ignoreUrlParametersMatching?: RegExp[] | undefined;
importScripts?: string[] | undefined;
logger?: Console['log'] | undefined;
maximumFileSizeToCacheInBytes?: number | undefined;
navigateFallback?: string | undefined;
navigateFallbackWhitelist?: RegExp[] | undefined;
replacePrefix?: string | undefined;
runtimeCaching?: Array<{
urlPattern: RegExp | string;
handler: Handler;
method?: Method | undefined;
options?: SwToolboxOptions | undefined;
}> | undefined;
skipWaiting?: boolean | undefined;
staticFileGlobs?: string[] | undefined;
stripPrefix?: string | undefined;
stripPrefixMulti?: {
[path: string]: string;
} | undefined;
templateFilePath?: string | undefined;
verbose?: boolean | undefined;
}
export type Generate = (
options?: Options,
callback?: (
error: NodeJS.ErrnoException,
serviceWorkerString: string,
) => void,
) => Promise<string>;
export type Write = (
filePath: string,
options?: Options,
callback?: (error: NodeJS.ErrnoException) => void,
) => Promise<string>;
export const generate: Generate;
export const write: Write;
Additional Details
- Last updated: Fri, 02 Jul 2021 22:33:15 GMT
- Dependencies: @types/sw-toolbox, @types/node
- Global values: none
Credits
These definitions were written by JounQin.