-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServiceWorkerGlobalScope.cljs
325 lines (230 loc) · 11.2 KB
/
ServiceWorkerGlobalScope.cljs
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
(ns web.workers.ServiceWorkerGlobalScope
"The ServiceWorkerGlobalScope interface of the ServiceWorker API
the global execution context of a service worker."
(:refer-clojure :exclude []))
(defn skip-waiting
"Method.
The ServiceWorkerGlobalScope.skipWaiting() method of the `web.workers.ServiceWorkerGlobalScope`
the waiting service worker to become the active service worker.
`ServiceWorkerGlobalScope.skipWaiting().then(function() {
//Do something
});`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting`"
[this & args]
(-> this .-skipWaiting (.apply this (clj->js args))))
(defn fetch
"Method.
Starts the process of fetching a resource. This returns a promise
resolves to the Response object representing the response to
request. This algorithm is the entry point for the fetch handling
to the service worker context."
[this & args]
(-> this .-fetch (.apply this (clj->js args))))
(defn clients
"Property.
The clients read-only property of the `web.workers.ServiceWorkerGlobalScope`
returns the Clients object associated with the service worker.
`swClients = self.clients`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/clients`"
[this]
(-> this (.-clients)))
(defn set-clients!
"Property.
The clients read-only property of the `web.workers.ServiceWorkerGlobalScope`
returns the Clients object associated with the service worker.
`swClients = self.clients`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/clients`"
[this val]
(aset this "clients" val))
(defn registration
"Property.
The registration read-only property of the `web.workers.ServiceWorkerGlobalScope`
returns a reference to the `web.workers.ServiceWorkerRegistration`
which represents the service worker's registration.
`serviceWorkerRegistration = self.registration`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/registration`"
[this]
(-> this (.-registration)))
(defn set-registration!
"Property.
The registration read-only property of the `web.workers.ServiceWorkerGlobalScope`
returns a reference to the `web.workers.ServiceWorkerRegistration`
which represents the service worker's registration.
`serviceWorkerRegistration = self.registration`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/registration`"
[this val]
(aset this "registration" val))
(defn caches
"Property.
The `ServiceWorkerGlobalScope.caches` read-only property returns
`web.service-workers.CacheStorage` object associated with the
worker.
`var myCacheStorage = self.caches;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/caches`"
[this]
(-> this (.-caches)))
(defn set-caches!
"Property.
The `ServiceWorkerGlobalScope.caches` read-only property returns
`web.service-workers.CacheStorage` object associated with the
worker.
`var myCacheStorage = self.caches;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/caches`"
[this val]
(aset this "caches" val))
(defn onactivate
"Property.
The onactivate property of the `web.workers.ServiceWorkerGlobalScope`
is an event handler fired whenever an activate event occurs (when
service worker activates). This happens after installation, when
page to be controlled by the service worker refreshes.
`ServiceWorkerGlobalScope.onactivate = function(event) { ... };`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onactivate`"
[this]
(-> this (.-onactivate)))
(defn set-onactivate!
"Property.
The onactivate property of the `web.workers.ServiceWorkerGlobalScope`
is an event handler fired whenever an activate event occurs (when
service worker activates). This happens after installation, when
page to be controlled by the service worker refreshes.
`ServiceWorkerGlobalScope.onactivate = function(event) { ... };`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onactivate`"
[this val]
(aset this "onactivate" val))
(defn onfetch
"Property.
The onfetch property of the `web.workers.ServiceWorkerGlobalScope`
is an event handler fired whenever a fetch event occurs (usually
the `ServiceWorkerGlobalScope.fetch` method is called.)
`ServiceWorkerGlobalScope.onfetch = function(FetchEvent) { ... }`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onfetch`"
[this]
(-> this (.-onfetch)))
(defn set-onfetch!
"Property.
The onfetch property of the `web.workers.ServiceWorkerGlobalScope`
is an event handler fired whenever a fetch event occurs (usually
the `ServiceWorkerGlobalScope.fetch` method is called.)
`ServiceWorkerGlobalScope.onfetch = function(FetchEvent) { ... }`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onfetch`"
[this val]
(aset this "onfetch" val))
(defn oninstall
"Property.
The oninstall property of the `web.workers.ServiceWorkerGlobalScope`
is an event handler fired whenever an install event occurs (when
service worker installs). This happens before activation.
`ServiceWorkerGlobalScope.oninstall = function(event) { ... };`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/oninstall`"
[this]
(-> this (.-oninstall)))
(defn set-oninstall!
"Property.
The oninstall property of the `web.workers.ServiceWorkerGlobalScope`
is an event handler fired whenever an install event occurs (when
service worker installs). This happens before activation.
`ServiceWorkerGlobalScope.oninstall = function(event) { ... };`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/oninstall`"
[this val]
(aset this "oninstall" val))
(defn onmessage
"Property.
The ServiceWorkerGlobalScope.onmessage event of the `web.workers.ServiceWorkerGlobalScope`
is called whenever incoming messages are received.
`ServiceWorkerGlobalScope.onmessage = function(MessageEvent) { ... }`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onmessage`"
[this]
(-> this (.-onmessage)))
(defn set-onmessage!
"Property.
The ServiceWorkerGlobalScope.onmessage event of the `web.workers.ServiceWorkerGlobalScope`
is called whenever incoming messages are received.
`ServiceWorkerGlobalScope.onmessage = function(MessageEvent) { ... }`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onmessage`"
[this val]
(aset this "onmessage" val))
(defn onnotificationclick
"Property.
The ServiceWorkerGlobalScope.onnotificationclick property is
event handler called whenever the notificationclick event is
on the `web.workers.ServiceWorkerGlobalScope` object, that is
a user clicks on a displayed notification spawned by `ServiceWorkerRegistration.showNotification()`.
`ServiceWorkerGlobalScope.onnotificationclick = function(NotificationEvent) { ... };`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onnotificationclick`"
[this]
(-> this (.-onnotificationclick)))
(defn set-onnotificationclick!
"Property.
The ServiceWorkerGlobalScope.onnotificationclick property is
event handler called whenever the notificationclick event is
on the `web.workers.ServiceWorkerGlobalScope` object, that is
a user clicks on a displayed notification spawned by `ServiceWorkerRegistration.showNotification()`.
`ServiceWorkerGlobalScope.onnotificationclick = function(NotificationEvent) { ... };`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onnotificationclick`"
[this val]
(aset this "onnotificationclick" val))
(defn onnotificationclose
"Property.
The ServiceWorkerGlobalScope.onnotificationclose property is
event handler called whenever the notificationclose event is
on the `web.workers.ServiceWorkerGlobalScope` object, that is
a user closes a displayed notification spawned by `ServiceWorkerRegistration.showNotification()`.
`ServiceWorkerGlobalScope.onnotificationclose = function(NotificationEvent) { ... };
ServiceWorkerGlobalScope.addEventListener('notificationclose', function(NotificationEvent) { ... });`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onnotificationclose`"
[this]
(-> this (.-onnotificationclose)))
(defn set-onnotificationclose!
"Property.
The ServiceWorkerGlobalScope.onnotificationclose property is
event handler called whenever the notificationclose event is
on the `web.workers.ServiceWorkerGlobalScope` object, that is
a user closes a displayed notification spawned by `ServiceWorkerRegistration.showNotification()`.
`ServiceWorkerGlobalScope.onnotificationclose = function(NotificationEvent) { ... };
ServiceWorkerGlobalScope.addEventListener('notificationclose', function(NotificationEvent) { ... });`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onnotificationclose`"
[this val]
(aset this "onnotificationclose" val))
(defn onpush
"Property.
The ServiceWorkerGlobalScope.onpush event of the `web.workers.ServiceWorkerGlobalScope`
is fired whenever a push message is received by a service worker
a push server.
`ServiceWorkerGlobalScope.onpush = function(PushEvent) { ... }
self.addEventListener('push', function(PushEvent) { ... })`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onpush`"
[this]
(-> this (.-onpush)))
(defn set-onpush!
"Property.
The ServiceWorkerGlobalScope.onpush event of the `web.workers.ServiceWorkerGlobalScope`
is fired whenever a push message is received by a service worker
a push server.
`ServiceWorkerGlobalScope.onpush = function(PushEvent) { ... }
self.addEventListener('push', function(PushEvent) { ... })`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onpush`"
[this val]
(aset this "onpush" val))
(defn onpushsubscriptionchange
"Property.
The ServiceWorkerGlobalScope.onpushsubscriptionchange event of
`web.workers.ServiceWorkerGlobalScope` interface is fired to
a change in push subscription that was triggered outside the
control, e.g. when browser refresh the push subscription.
`ServiceWorkerGlobalScope.onpushsubscriptionchange = function() { ... }
self.addEventListener('pushsubscriptionchange', function() { ... })`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onpushsubscriptionchange`"
[this]
(-> this (.-onpushsubscriptionchange)))
(defn set-onpushsubscriptionchange!
"Property.
The ServiceWorkerGlobalScope.onpushsubscriptionchange event of
`web.workers.ServiceWorkerGlobalScope` interface is fired to
a change in push subscription that was triggered outside the
control, e.g. when browser refresh the push subscription.
`ServiceWorkerGlobalScope.onpushsubscriptionchange = function() { ... }
self.addEventListener('pushsubscriptionchange', function() { ... })`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onpushsubscriptionchange`"
[this val]
(aset this "onpushsubscriptionchange" val))