Skip to content

Instantly share code, notes, and snippets.

@webmaxru
Created October 2, 2017 10:30
Show Gist options
  • Save webmaxru/1c0e32048121c795c2d986de61387e22 to your computer and use it in GitHub Desktop.
Save webmaxru/1c0e32048121c795c2d986de61387e22 to your computer and use it in GitHub Desktop.
ngsw - configuration interface
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @experimental
*/
export declare type Glob = string;
/**
* @experimental
*/
export declare type Duration = string;
/**
* A top-level Angular Service Worker configuration object.
*
* @experimental
*/
export interface Config {
appData?: {};
index: string;
assetGroups?: AssetGroup[];
dataGroups?: DataGroup[];
}
/**
* Configuration for a particular group of assets.
*
* @experimental
*/
export interface AssetGroup {
name: string;
installMode?: 'prefetch' | 'lazy';
updateMode?: 'prefetch' | 'lazy';
resources: {
files?: Glob[];
versionedFiles?: Glob[];
urls?: Glob[];
};
}
/**
* Configuration for a particular group of dynamic URLs.
*
* @experimental
*/
export interface DataGroup {
name: string;
urls: Glob[];
version?: number;
cacheConfig: {
maxSize: number;
maxAge: Duration;
timeout?: Duration;
strategy?: 'freshness' | 'performance';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment