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