-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathServiceWorkerAPI.res
More file actions
134 lines (119 loc) · 4.39 KB
/
Copy pathServiceWorkerAPI.res
File metadata and controls
134 lines (119 loc) · 4.39 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@@warning("-30")
open Prelude
open EventAPI
open PushManagerAPI
open NotificationAPI
open FetchAPI
open ChannelMessagingAPI
type serviceWorkerState =
| @as("activated") Activated
| @as("activating") Activating
| @as("installed") Installed
| @as("installing") Installing
| @as("parsed") Parsed
| @as("redundant") Redundant
type serviceWorkerUpdateViaCache =
| @as("all") All
| @as("imports") Imports
| @as("none") None
type workerType =
| @as("classic") Classic
| @as("module") Module
/**
This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object.
[See ServiceWorker on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker)
*/
type serviceWorker = {
...eventTarget,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/scriptURL)
*/
scriptURL: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/state)
*/
state: serviceWorkerState,
}
/**
[See NavigationPreloadManager on MDN](https://developer.mozilla.org/docs/Web/API/NavigationPreloadManager)
*/
type navigationPreloadManager = {}
/**
This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
[See ServiceWorkerRegistration on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
*/
type serviceWorkerRegistration = {
...eventTarget,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/installing)
*/
installing: Null.t<serviceWorker>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/waiting)
*/
waiting: Null.t<serviceWorker>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/active)
*/
active: Null.t<serviceWorker>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/navigationPreload)
*/
navigationPreload: navigationPreloadManager,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/scope)
*/
scope: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/updateViaCache)
*/
updateViaCache: serviceWorkerUpdateViaCache,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager)
*/
pushManager: pushManager,
}
/**
The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
[See ServiceWorkerContainer on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer)
*/
type serviceWorkerContainer = {
...eventTarget,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/controller)
*/
controller: Null.t<serviceWorker>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/ready)
*/
ready: Promise.t<serviceWorkerRegistration>,
}
/**
The storage for Cache objects.
[See CacheStorage on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage)
*/
type cacheStorage = {}
/**
Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
[See Cache on MDN](https://developer.mozilla.org/docs/Web/API/Cache)
*/
type cache = {}
type navigationPreloadState = {
mutable enabled?: bool,
mutable headerValue?: string,
}
type registrationOptions = {
mutable scope?: string,
@as("type") mutable type_?: workerType,
mutable updateViaCache?: serviceWorkerUpdateViaCache,
}
type cacheQueryOptions = {
mutable ignoreSearch?: bool,
mutable ignoreMethod?: bool,
mutable ignoreVary?: bool,
}
type multiCacheQueryOptions = {
...cacheQueryOptions,
mutable cacheName?: string,
}
type requestInfo = any