UNPKG

1.82 kBTypeScriptView Raw
1export interface InstallOptions {
2 /**
3 * Event called exactly once when ServiceWorker or AppCache is installed.
4 * Can be useful to display "App is ready for offline usage" message.
5 *
6 * @memberOf InstallOptions
7 */
8 onInstalled?: () => void;
9
10 /**
11 * Not supported for AppCache.
12 * Event called when update is found and browsers started updating process.
13 * At this moment, some assets are downloading.
14 *
15 * @memberOf InstallOptions
16 */
17 onUpdating?: () => void;
18
19 /**
20 * Event called when onUpdating phase finished.
21 * All required assets are downloaded at this moment and are ready to be updated.
22 * Call runtime.applyUpdate() to apply update.
23 *
24 * @memberOf InstallOptions
25 */
26 onUpdateReady?: () => void;
27
28 /**
29 * Event called when upUpdating phase failed by some reason.
30 * Nothing is downloaded at this moment and current update process
31 * in your code should be canceled or ignored.
32 *
33 * @memberOf InstallOptions
34 */
35 onUpdateFailed?: () => void;
36
37 /**
38 * Event called when update is applied,
39 * either by calling runtime.applyUpdate() or
40 * some other way by a browser itself.
41 *
42 * @memberOf InstallOptions
43 */
44 onUpdated?: () => void;
45}
46
47/**
48 * Starts installation flow for ServiceWorker/AppCache
49 * it's safe and must be called each time your page loads
50 * (i.e. do not wrap it into any conditions).
51 *
52 * @param {InstallOptions} [options] The install options.
53 *
54 * @memberOf RuntimeStatic
55 */
56export function install(options?: InstallOptions): void;
57
58/**
59 * Used to apply update for existing installation.
60 * See InstallOptions.
61 *
62 * @memberOf RuntimeStatic
63 */
64export function applyUpdate(): void;
65
66/**
67 * Performs check for updates of new ServiceWorker/AppCache.
68 *
69 * @memberOf RuntimeStatic
70 */
71export function update(): void;
\No newline at end of file