@types/sw-precache
TypeScript icon, indicating that this package has built-in type declarations

5.2.4 • Public • Published

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

/// <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

Credits

These definitions were written by JounQin.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/sw-precache

Weekly Downloads

1,232

Version

5.2.4

License

MIT

Unpacked Size

6.48 kB

Total Files

5

Last publish

Collaborators

  • types