@angular/service-worker 12.2.8 → 13.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/config.d.ts +1 -1
- package/config/package.json +5 -5
- package/{esm2015/config/config.js → esm2020/config/config.mjs} +0 -0
- package/{esm2015/config/index.js → esm2020/config/index.mjs} +0 -0
- package/{esm2015/config/public_api.js → esm2020/config/public_api.mjs} +0 -0
- package/{esm2015/config/src/duration.js → esm2020/config/src/duration.mjs} +0 -0
- package/{esm2015/config/src/filesystem.js → esm2020/config/src/filesystem.mjs} +0 -0
- package/esm2020/config/src/generator.mjs +147 -0
- package/{esm2015/config/src/glob.js → esm2020/config/src/glob.mjs} +0 -0
- package/{esm2015/config/src/in.js → esm2020/config/src/in.mjs} +0 -0
- package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/esm2020/service-worker.mjs +5 -0
- package/{esm2015/src/index.js → esm2020/src/index.mjs} +0 -0
- package/esm2020/src/low_level.mjs +78 -0
- package/esm2020/src/module.mjs +128 -0
- package/esm2020/src/push.mjs +174 -0
- package/esm2020/src/update.mjs +61 -0
- package/fesm2015/{config.js → config.mjs} +2 -9
- package/fesm2015/config.mjs.map +1 -0
- package/fesm2015/{service-worker.js → service-worker.mjs} +23 -20
- package/fesm2015/service-worker.mjs.map +1 -0
- package/fesm2020/config.mjs +267 -0
- package/fesm2020/config.mjs.map +1 -0
- package/fesm2020/service-worker.mjs +463 -0
- package/fesm2020/service-worker.mjs.map +1 -0
- package/ngsw-config.js +169 -218
- package/ngsw-worker.js +1421 -1587
- package/package.json +36 -9
- package/service-worker.d.ts +29 -29
- package/bundles/service-worker-config.umd.js +0 -626
- package/bundles/service-worker-config.umd.js.map +0 -1
- package/bundles/service-worker.umd.js +0 -804
- package/bundles/service-worker.umd.js.map +0 -1
- package/config/config.metadata.json +0 -1
- package/config/index.ngfactory.d.ts +0 -2
- package/config/index.ngsummary.d.ts +0 -2
- package/config/public_api.ngfactory.d.ts +0 -2
- package/config/public_api.ngsummary.d.ts +0 -2
- package/config/src/duration.ngfactory.d.ts +0 -2
- package/config/src/duration.ngsummary.d.ts +0 -2
- package/config/src/filesystem.ngfactory.d.ts +0 -2
- package/config/src/filesystem.ngsummary.d.ts +0 -2
- package/config/src/generator.ngfactory.d.ts +0 -2
- package/config/src/generator.ngsummary.d.ts +0 -2
- package/config/src/glob.ngfactory.d.ts +0 -2
- package/config/src/glob.ngsummary.d.ts +0 -2
- package/config/src/in.ngfactory.d.ts +0 -2
- package/config/src/in.ngsummary.d.ts +0 -2
- package/config.d.ts +0 -7
- package/config.metadata.json +0 -1
- package/esm2015/config/config.externs.js +0 -6
- package/esm2015/config/src/generator.js +0 -150
- package/esm2015/service-worker.externs.js +0 -6
- package/esm2015/service-worker.js +0 -7
- package/esm2015/src/low_level.js +0 -75
- package/esm2015/src/module.js +0 -123
- package/esm2015/src/push.js +0 -173
- package/esm2015/src/update.js +0 -60
- package/fesm2015/config.js.map +0 -1
- package/fesm2015/service-worker.js.map +0 -1
- package/service-worker.metadata.json +0 -1
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Angular v13.0.0-next.11
|
|
3
|
+
* (c) 2010-2021 Google LLC. https://angular.io/
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
8
|
+
import * as i0 from '@angular/core';
|
|
9
|
+
import { Injectable, InjectionToken, NgZone, ApplicationRef, PLATFORM_ID, APP_INITIALIZER, Injector, NgModule } from '@angular/core';
|
|
10
|
+
import { defer, throwError, fromEvent, of, concat, Subject, NEVER, merge } from 'rxjs';
|
|
11
|
+
import { map, filter, switchMap, publish, take, tap, delay } from 'rxjs/operators';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright Google LLC All Rights Reserved.
|
|
16
|
+
*
|
|
17
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
18
|
+
* found in the LICENSE file at https://angular.io/license
|
|
19
|
+
*/
|
|
20
|
+
const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';
|
|
21
|
+
function errorObservable(message) {
|
|
22
|
+
return defer(() => throwError(new Error(message)));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @publicApi
|
|
26
|
+
*/
|
|
27
|
+
class NgswCommChannel {
|
|
28
|
+
constructor(serviceWorker) {
|
|
29
|
+
this.serviceWorker = serviceWorker;
|
|
30
|
+
if (!serviceWorker) {
|
|
31
|
+
this.worker = this.events = this.registration = errorObservable(ERR_SW_NOT_SUPPORTED);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const controllerChangeEvents = fromEvent(serviceWorker, 'controllerchange');
|
|
35
|
+
const controllerChanges = controllerChangeEvents.pipe(map(() => serviceWorker.controller));
|
|
36
|
+
const currentController = defer(() => of(serviceWorker.controller));
|
|
37
|
+
const controllerWithChanges = concat(currentController, controllerChanges);
|
|
38
|
+
this.worker = controllerWithChanges.pipe(filter((c) => !!c));
|
|
39
|
+
this.registration = (this.worker.pipe(switchMap(() => serviceWorker.getRegistration())));
|
|
40
|
+
const rawEvents = fromEvent(serviceWorker, 'message');
|
|
41
|
+
const rawEventPayload = rawEvents.pipe(map(event => event.data));
|
|
42
|
+
const eventsUnconnected = rawEventPayload.pipe(filter(event => event && event.type));
|
|
43
|
+
const events = eventsUnconnected.pipe(publish());
|
|
44
|
+
events.connect();
|
|
45
|
+
this.events = events;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
postMessage(action, payload) {
|
|
49
|
+
return this.worker
|
|
50
|
+
.pipe(take(1), tap((sw) => {
|
|
51
|
+
sw.postMessage({
|
|
52
|
+
action,
|
|
53
|
+
...payload,
|
|
54
|
+
});
|
|
55
|
+
}))
|
|
56
|
+
.toPromise()
|
|
57
|
+
.then(() => undefined);
|
|
58
|
+
}
|
|
59
|
+
postMessageWithStatus(type, payload, nonce) {
|
|
60
|
+
const waitForStatus = this.waitForStatus(nonce);
|
|
61
|
+
const postMessage = this.postMessage(type, payload);
|
|
62
|
+
return Promise.all([waitForStatus, postMessage]).then(() => undefined);
|
|
63
|
+
}
|
|
64
|
+
generateNonce() {
|
|
65
|
+
return Math.round(Math.random() * 10000000);
|
|
66
|
+
}
|
|
67
|
+
eventsOfType(type) {
|
|
68
|
+
const filterFn = (event) => event.type === type;
|
|
69
|
+
return this.events.pipe(filter(filterFn));
|
|
70
|
+
}
|
|
71
|
+
nextEventOfType(type) {
|
|
72
|
+
return this.eventsOfType(type).pipe(take(1));
|
|
73
|
+
}
|
|
74
|
+
waitForStatus(nonce) {
|
|
75
|
+
return this.eventsOfType('STATUS')
|
|
76
|
+
.pipe(filter(event => event.nonce === nonce), take(1), map(event => {
|
|
77
|
+
if (event.status) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
throw new Error(event.error);
|
|
81
|
+
}))
|
|
82
|
+
.toPromise();
|
|
83
|
+
}
|
|
84
|
+
get isEnabled() {
|
|
85
|
+
return !!this.serviceWorker;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @license
|
|
91
|
+
* Copyright Google LLC All Rights Reserved.
|
|
92
|
+
*
|
|
93
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
94
|
+
* found in the LICENSE file at https://angular.io/license
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* Subscribe and listen to
|
|
98
|
+
* [Web Push
|
|
99
|
+
* Notifications](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) through
|
|
100
|
+
* Angular Service Worker.
|
|
101
|
+
*
|
|
102
|
+
* @usageNotes
|
|
103
|
+
*
|
|
104
|
+
* You can inject a `SwPush` instance into any component or service
|
|
105
|
+
* as a dependency.
|
|
106
|
+
*
|
|
107
|
+
* <code-example path="service-worker/push/module.ts" region="inject-sw-push"
|
|
108
|
+
* header="app.component.ts"></code-example>
|
|
109
|
+
*
|
|
110
|
+
* To subscribe, call `SwPush.requestSubscription()`, which asks the user for permission.
|
|
111
|
+
* The call returns a `Promise` with a new
|
|
112
|
+
* [`PushSubscription`](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)
|
|
113
|
+
* instance.
|
|
114
|
+
*
|
|
115
|
+
* <code-example path="service-worker/push/module.ts" region="subscribe-to-push"
|
|
116
|
+
* header="app.component.ts"></code-example>
|
|
117
|
+
*
|
|
118
|
+
* A request is rejected if the user denies permission, or if the browser
|
|
119
|
+
* blocks or does not support the Push API or ServiceWorkers.
|
|
120
|
+
* Check `SwPush.isEnabled` to confirm status.
|
|
121
|
+
*
|
|
122
|
+
* Invoke Push Notifications by pushing a message with the following payload.
|
|
123
|
+
*
|
|
124
|
+
* ```ts
|
|
125
|
+
* {
|
|
126
|
+
* "notification": {
|
|
127
|
+
* "actions": NotificationAction[],
|
|
128
|
+
* "badge": USVString,
|
|
129
|
+
* "body": DOMString,
|
|
130
|
+
* "data": any,
|
|
131
|
+
* "dir": "auto"|"ltr"|"rtl",
|
|
132
|
+
* "icon": USVString,
|
|
133
|
+
* "image": USVString,
|
|
134
|
+
* "lang": DOMString,
|
|
135
|
+
* "renotify": boolean,
|
|
136
|
+
* "requireInteraction": boolean,
|
|
137
|
+
* "silent": boolean,
|
|
138
|
+
* "tag": DOMString,
|
|
139
|
+
* "timestamp": DOMTimeStamp,
|
|
140
|
+
* "title": DOMString,
|
|
141
|
+
* "vibrate": number[]
|
|
142
|
+
* }
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* Only `title` is required. See `Notification`
|
|
147
|
+
* [instance
|
|
148
|
+
* properties](https://developer.mozilla.org/en-US/docs/Web/API/Notification#Instance_properties).
|
|
149
|
+
*
|
|
150
|
+
* While the subscription is active, Service Worker listens for
|
|
151
|
+
* [PushEvent](https://developer.mozilla.org/en-US/docs/Web/API/PushEvent)
|
|
152
|
+
* occurrences and creates
|
|
153
|
+
* [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification)
|
|
154
|
+
* instances in response.
|
|
155
|
+
*
|
|
156
|
+
* Unsubscribe using `SwPush.unsubscribe()`.
|
|
157
|
+
*
|
|
158
|
+
* An application can subscribe to `SwPush.notificationClicks` observable to be notified when a user
|
|
159
|
+
* clicks on a notification. For example:
|
|
160
|
+
*
|
|
161
|
+
* <code-example path="service-worker/push/module.ts" region="subscribe-to-notification-clicks"
|
|
162
|
+
* header="app.component.ts"></code-example>
|
|
163
|
+
*
|
|
164
|
+
* You can read more on handling notification clicks in the [Service worker notifications
|
|
165
|
+
* guide](guide/service-worker-notifications).
|
|
166
|
+
*
|
|
167
|
+
* @see [Push Notifications](https://developers.google.com/web/fundamentals/codelabs/push-notifications/)
|
|
168
|
+
* @see [Angular Push Notifications](https://blog.angular-university.io/angular-push-notifications/)
|
|
169
|
+
* @see [MDN: Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API)
|
|
170
|
+
* @see [MDN: Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API)
|
|
171
|
+
* @see [MDN: Web Push API Notifications best practices](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices)
|
|
172
|
+
*
|
|
173
|
+
* @publicApi
|
|
174
|
+
*/
|
|
175
|
+
class SwPush {
|
|
176
|
+
constructor(sw) {
|
|
177
|
+
this.sw = sw;
|
|
178
|
+
this.subscriptionChanges = new Subject();
|
|
179
|
+
if (!sw.isEnabled) {
|
|
180
|
+
this.messages = NEVER;
|
|
181
|
+
this.notificationClicks = NEVER;
|
|
182
|
+
this.subscription = NEVER;
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
this.messages = this.sw.eventsOfType('PUSH').pipe(map(message => message.data));
|
|
186
|
+
this.notificationClicks =
|
|
187
|
+
this.sw.eventsOfType('NOTIFICATION_CLICK').pipe(map((message) => message.data));
|
|
188
|
+
this.pushManager = this.sw.registration.pipe(map(registration => registration.pushManager));
|
|
189
|
+
const workerDrivenSubscriptions = this.pushManager.pipe(switchMap(pm => pm.getSubscription()));
|
|
190
|
+
this.subscription = merge(workerDrivenSubscriptions, this.subscriptionChanges);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* True if the Service Worker is enabled (supported by the browser and enabled via
|
|
194
|
+
* `ServiceWorkerModule`).
|
|
195
|
+
*/
|
|
196
|
+
get isEnabled() {
|
|
197
|
+
return this.sw.isEnabled;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Subscribes to Web Push Notifications,
|
|
201
|
+
* after requesting and receiving user permission.
|
|
202
|
+
*
|
|
203
|
+
* @param options An object containing the `serverPublicKey` string.
|
|
204
|
+
* @returns A Promise that resolves to the new subscription object.
|
|
205
|
+
*/
|
|
206
|
+
requestSubscription(options) {
|
|
207
|
+
if (!this.sw.isEnabled) {
|
|
208
|
+
return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));
|
|
209
|
+
}
|
|
210
|
+
const pushOptions = { userVisibleOnly: true };
|
|
211
|
+
let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));
|
|
212
|
+
let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));
|
|
213
|
+
for (let i = 0; i < key.length; i++) {
|
|
214
|
+
applicationServerKey[i] = key.charCodeAt(i);
|
|
215
|
+
}
|
|
216
|
+
pushOptions.applicationServerKey = applicationServerKey;
|
|
217
|
+
return this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1))
|
|
218
|
+
.toPromise()
|
|
219
|
+
.then(sub => {
|
|
220
|
+
this.subscriptionChanges.next(sub);
|
|
221
|
+
return sub;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Unsubscribes from Service Worker push notifications.
|
|
226
|
+
*
|
|
227
|
+
* @returns A Promise that is resolved when the operation succeeds, or is rejected if there is no
|
|
228
|
+
* active subscription or the unsubscribe operation fails.
|
|
229
|
+
*/
|
|
230
|
+
unsubscribe() {
|
|
231
|
+
if (!this.sw.isEnabled) {
|
|
232
|
+
return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));
|
|
233
|
+
}
|
|
234
|
+
const doUnsubscribe = (sub) => {
|
|
235
|
+
if (sub === null) {
|
|
236
|
+
throw new Error('Not subscribed to push notifications.');
|
|
237
|
+
}
|
|
238
|
+
return sub.unsubscribe().then(success => {
|
|
239
|
+
if (!success) {
|
|
240
|
+
throw new Error('Unsubscribe failed!');
|
|
241
|
+
}
|
|
242
|
+
this.subscriptionChanges.next(null);
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise();
|
|
246
|
+
}
|
|
247
|
+
decodeBase64(input) {
|
|
248
|
+
return atob(input);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
SwPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: SwPush, deps: [{ token: NgswCommChannel }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
252
|
+
SwPush.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: SwPush });
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: SwPush, decorators: [{
|
|
254
|
+
type: Injectable
|
|
255
|
+
}], ctorParameters: function () { return [{ type: NgswCommChannel }]; } });
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @license
|
|
259
|
+
* Copyright Google LLC All Rights Reserved.
|
|
260
|
+
*
|
|
261
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
262
|
+
* found in the LICENSE file at https://angular.io/license
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* Subscribe to update notifications from the Service Worker, trigger update
|
|
266
|
+
* checks, and forcibly activate updates.
|
|
267
|
+
*
|
|
268
|
+
* @see {@link guide/service-worker-communications Service worker communication guide}
|
|
269
|
+
*
|
|
270
|
+
* @publicApi
|
|
271
|
+
*/
|
|
272
|
+
class SwUpdate {
|
|
273
|
+
constructor(sw) {
|
|
274
|
+
this.sw = sw;
|
|
275
|
+
if (!sw.isEnabled) {
|
|
276
|
+
this.available = NEVER;
|
|
277
|
+
this.activated = NEVER;
|
|
278
|
+
this.unrecoverable = NEVER;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
this.available = this.sw.eventsOfType('UPDATE_AVAILABLE');
|
|
282
|
+
this.activated = this.sw.eventsOfType('UPDATE_ACTIVATED');
|
|
283
|
+
this.unrecoverable = this.sw.eventsOfType('UNRECOVERABLE_STATE');
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* True if the Service Worker is enabled (supported by the browser and enabled via
|
|
287
|
+
* `ServiceWorkerModule`).
|
|
288
|
+
*/
|
|
289
|
+
get isEnabled() {
|
|
290
|
+
return this.sw.isEnabled;
|
|
291
|
+
}
|
|
292
|
+
checkForUpdate() {
|
|
293
|
+
if (!this.sw.isEnabled) {
|
|
294
|
+
return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));
|
|
295
|
+
}
|
|
296
|
+
const statusNonce = this.sw.generateNonce();
|
|
297
|
+
return this.sw.postMessageWithStatus('CHECK_FOR_UPDATES', { statusNonce }, statusNonce);
|
|
298
|
+
}
|
|
299
|
+
activateUpdate() {
|
|
300
|
+
if (!this.sw.isEnabled) {
|
|
301
|
+
return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));
|
|
302
|
+
}
|
|
303
|
+
const statusNonce = this.sw.generateNonce();
|
|
304
|
+
return this.sw.postMessageWithStatus('ACTIVATE_UPDATE', { statusNonce }, statusNonce);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
SwUpdate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: SwUpdate, deps: [{ token: NgswCommChannel }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
308
|
+
SwUpdate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: SwUpdate });
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: SwUpdate, decorators: [{
|
|
310
|
+
type: Injectable
|
|
311
|
+
}], ctorParameters: function () { return [{ type: NgswCommChannel }]; } });
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @license
|
|
315
|
+
* Copyright Google LLC All Rights Reserved.
|
|
316
|
+
*
|
|
317
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
318
|
+
* found in the LICENSE file at https://angular.io/license
|
|
319
|
+
*/
|
|
320
|
+
/**
|
|
321
|
+
* Token that can be used to provide options for `ServiceWorkerModule` outside of
|
|
322
|
+
* `ServiceWorkerModule.register()`.
|
|
323
|
+
*
|
|
324
|
+
* You can use this token to define a provider that generates the registration options at runtime,
|
|
325
|
+
* for example via a function call:
|
|
326
|
+
*
|
|
327
|
+
* {@example service-worker/registration-options/module.ts region="registration-options"
|
|
328
|
+
* header="app.module.ts"}
|
|
329
|
+
*
|
|
330
|
+
* @publicApi
|
|
331
|
+
*/
|
|
332
|
+
class SwRegistrationOptions {
|
|
333
|
+
}
|
|
334
|
+
const SCRIPT = new InjectionToken('NGSW_REGISTER_SCRIPT');
|
|
335
|
+
function ngswAppInitializer(injector, script, options, platformId) {
|
|
336
|
+
const initializer = () => {
|
|
337
|
+
if (!(isPlatformBrowser(platformId) && ('serviceWorker' in navigator) &&
|
|
338
|
+
options.enabled !== false)) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
// Wait for service worker controller changes, and fire an INITIALIZE action when a new SW
|
|
342
|
+
// becomes active. This allows the SW to initialize itself even if there is no application
|
|
343
|
+
// traffic.
|
|
344
|
+
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
|
345
|
+
if (navigator.serviceWorker.controller !== null) {
|
|
346
|
+
navigator.serviceWorker.controller.postMessage({ action: 'INITIALIZE' });
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
let readyToRegister$;
|
|
350
|
+
if (typeof options.registrationStrategy === 'function') {
|
|
351
|
+
readyToRegister$ = options.registrationStrategy();
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
const [strategy, ...args] = (options.registrationStrategy || 'registerWhenStable:30000').split(':');
|
|
355
|
+
switch (strategy) {
|
|
356
|
+
case 'registerImmediately':
|
|
357
|
+
readyToRegister$ = of(null);
|
|
358
|
+
break;
|
|
359
|
+
case 'registerWithDelay':
|
|
360
|
+
readyToRegister$ = delayWithTimeout(+args[0] || 0);
|
|
361
|
+
break;
|
|
362
|
+
case 'registerWhenStable':
|
|
363
|
+
readyToRegister$ = !args[0] ? whenStable(injector) :
|
|
364
|
+
merge(whenStable(injector), delayWithTimeout(+args[0]));
|
|
365
|
+
break;
|
|
366
|
+
default:
|
|
367
|
+
// Unknown strategy.
|
|
368
|
+
throw new Error(`Unknown ServiceWorker registration strategy: ${options.registrationStrategy}`);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// Don't return anything to avoid blocking the application until the SW is registered.
|
|
372
|
+
// Also, run outside the Angular zone to avoid preventing the app from stabilizing (especially
|
|
373
|
+
// given that some registration strategies wait for the app to stabilize).
|
|
374
|
+
// Catch and log the error if SW registration fails to avoid uncaught rejection warning.
|
|
375
|
+
const ngZone = injector.get(NgZone);
|
|
376
|
+
ngZone.runOutsideAngular(() => readyToRegister$.pipe(take(1)).subscribe(() => navigator.serviceWorker.register(script, { scope: options.scope })
|
|
377
|
+
.catch(err => console.error('Service worker registration failed with:', err))));
|
|
378
|
+
};
|
|
379
|
+
return initializer;
|
|
380
|
+
}
|
|
381
|
+
function delayWithTimeout(timeout) {
|
|
382
|
+
return of(null).pipe(delay(timeout));
|
|
383
|
+
}
|
|
384
|
+
function whenStable(injector) {
|
|
385
|
+
const appRef = injector.get(ApplicationRef);
|
|
386
|
+
return appRef.isStable.pipe(filter(stable => stable));
|
|
387
|
+
}
|
|
388
|
+
function ngswCommChannelFactory(opts, platformId) {
|
|
389
|
+
return new NgswCommChannel(isPlatformBrowser(platformId) && opts.enabled !== false ? navigator.serviceWorker :
|
|
390
|
+
undefined);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* @publicApi
|
|
394
|
+
*/
|
|
395
|
+
class ServiceWorkerModule {
|
|
396
|
+
/**
|
|
397
|
+
* Register the given Angular Service Worker script.
|
|
398
|
+
*
|
|
399
|
+
* If `enabled` is set to `false` in the given options, the module will behave as if service
|
|
400
|
+
* workers are not supported by the browser, and the service worker will not be registered.
|
|
401
|
+
*/
|
|
402
|
+
static register(script, opts = {}) {
|
|
403
|
+
return {
|
|
404
|
+
ngModule: ServiceWorkerModule,
|
|
405
|
+
providers: [
|
|
406
|
+
{ provide: SCRIPT, useValue: script },
|
|
407
|
+
{ provide: SwRegistrationOptions, useValue: opts },
|
|
408
|
+
{
|
|
409
|
+
provide: NgswCommChannel,
|
|
410
|
+
useFactory: ngswCommChannelFactory,
|
|
411
|
+
deps: [SwRegistrationOptions, PLATFORM_ID]
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
provide: APP_INITIALIZER,
|
|
415
|
+
useFactory: ngswAppInitializer,
|
|
416
|
+
deps: [Injector, SCRIPT, SwRegistrationOptions, PLATFORM_ID],
|
|
417
|
+
multi: true,
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
ServiceWorkerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: ServiceWorkerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
424
|
+
ServiceWorkerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: ServiceWorkerModule });
|
|
425
|
+
ServiceWorkerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: ServiceWorkerModule, providers: [SwPush, SwUpdate] });
|
|
426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-next.11", ngImport: i0, type: ServiceWorkerModule, decorators: [{
|
|
427
|
+
type: NgModule,
|
|
428
|
+
args: [{
|
|
429
|
+
providers: [SwPush, SwUpdate],
|
|
430
|
+
}]
|
|
431
|
+
}] });
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @license
|
|
435
|
+
* Copyright Google LLC All Rights Reserved.
|
|
436
|
+
*
|
|
437
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
438
|
+
* found in the LICENSE file at https://angular.io/license
|
|
439
|
+
*/
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* @license
|
|
443
|
+
* Copyright Google LLC All Rights Reserved.
|
|
444
|
+
*
|
|
445
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
446
|
+
* found in the LICENSE file at https://angular.io/license
|
|
447
|
+
*/
|
|
448
|
+
// This file only reexports content of the `src` folder. Keep it that way.
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* @license
|
|
452
|
+
* Copyright Google LLC All Rights Reserved.
|
|
453
|
+
*
|
|
454
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
455
|
+
* found in the LICENSE file at https://angular.io/license
|
|
456
|
+
*/
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Generated bundle index. Do not edit.
|
|
460
|
+
*/
|
|
461
|
+
|
|
462
|
+
export { ServiceWorkerModule, SwPush, SwRegistrationOptions, SwUpdate };
|
|
463
|
+
//# sourceMappingURL=service-worker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-worker.mjs","sources":["../../../../../../packages/service-worker/src/low_level.ts","../../../../../../packages/service-worker/src/push.ts","../../../../../../packages/service-worker/src/update.ts","../../../../../../packages/service-worker/src/module.ts","../../../../../../packages/service-worker/src/index.ts","../../../../../../packages/service-worker/public_api.ts","../../../../../../packages/service-worker/index.ts","../../../../../../packages/service-worker/service-worker.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {concat, ConnectableObservable, defer, fromEvent, Observable, of, throwError} from 'rxjs';\nimport {filter, map, publish, switchMap, take, tap} from 'rxjs/operators';\n\nexport const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';\n\n/**\n * An event emitted when a new version of the app is available.\n *\n * @see {@link guide/service-worker-communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface UpdateAvailableEvent {\n type: 'UPDATE_AVAILABLE';\n current: {hash: string, appData?: Object};\n available: {hash: string, appData?: Object};\n}\n\n/**\n * An event emitted when a new version of the app has been downloaded and activated.\n *\n * @see {@link guide/service-worker-communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface UpdateActivatedEvent {\n type: 'UPDATE_ACTIVATED';\n previous?: {hash: string, appData?: Object};\n current: {hash: string, appData?: Object};\n}\n\n/**\n * An event emitted when the version of the app used by the service worker to serve this client is\n * in a broken state that cannot be recovered from and a full page reload is required.\n *\n * For example, the service worker may not be able to retrieve a required resource, neither from the\n * cache nor from the server. This could happen if a new version is deployed to the server and the\n * service worker cache has been partially cleaned by the browser, removing some files of a previous\n * app version but not all.\n *\n * @see {@link guide/service-worker-communications Service worker communication guide}\n *\n * @publicApi\n */\nexport interface UnrecoverableStateEvent {\n type: 'UNRECOVERABLE_STATE';\n reason: string;\n}\n\n/**\n * An event emitted when a `PushEvent` is received by the service worker.\n */\nexport interface PushEvent {\n type: 'PUSH';\n data: any;\n}\n\nexport type IncomingEvent = UpdateAvailableEvent|UpdateActivatedEvent|UnrecoverableStateEvent;\n\nexport interface TypedEvent {\n type: string;\n}\n\ninterface StatusEvent {\n type: 'STATUS';\n nonce: number;\n status: boolean;\n error?: string;\n}\n\n\nfunction errorObservable(message: string): Observable<any> {\n return defer(() => throwError(new Error(message)));\n}\n\n/**\n * @publicApi\n */\nexport class NgswCommChannel {\n readonly worker: Observable<ServiceWorker>;\n\n readonly registration: Observable<ServiceWorkerRegistration>;\n\n readonly events: Observable<TypedEvent>;\n\n constructor(private serviceWorker: ServiceWorkerContainer|undefined) {\n if (!serviceWorker) {\n this.worker = this.events = this.registration = errorObservable(ERR_SW_NOT_SUPPORTED);\n } else {\n const controllerChangeEvents = fromEvent(serviceWorker, 'controllerchange');\n const controllerChanges = controllerChangeEvents.pipe(map(() => serviceWorker.controller));\n const currentController = defer(() => of(serviceWorker.controller));\n const controllerWithChanges = concat(currentController, controllerChanges);\n\n this.worker = controllerWithChanges.pipe(filter((c): c is ServiceWorker => !!c));\n\n this.registration = <Observable<ServiceWorkerRegistration>>(\n this.worker.pipe(switchMap(() => serviceWorker.getRegistration())));\n\n const rawEvents = fromEvent<MessageEvent>(serviceWorker, 'message');\n const rawEventPayload = rawEvents.pipe(map(event => event.data));\n const eventsUnconnected = rawEventPayload.pipe(filter(event => event && event.type));\n const events = eventsUnconnected.pipe(publish()) as ConnectableObservable<IncomingEvent>;\n events.connect();\n\n this.events = events;\n }\n }\n\n postMessage(action: string, payload: Object): Promise<void> {\n return this.worker\n .pipe(take(1), tap((sw: ServiceWorker) => {\n sw.postMessage({\n action,\n ...payload,\n });\n }))\n .toPromise()\n .then(() => undefined);\n }\n\n postMessageWithStatus(type: string, payload: Object, nonce: number): Promise<void> {\n const waitForStatus = this.waitForStatus(nonce);\n const postMessage = this.postMessage(type, payload);\n return Promise.all([waitForStatus, postMessage]).then(() => undefined);\n }\n\n generateNonce(): number {\n return Math.round(Math.random() * 10000000);\n }\n\n eventsOfType<T extends TypedEvent>(type: T['type']): Observable<T> {\n const filterFn = (event: TypedEvent): event is T => event.type === type;\n return this.events.pipe(filter(filterFn));\n }\n\n nextEventOfType<T extends TypedEvent>(type: T['type']): Observable<T> {\n return this.eventsOfType(type).pipe(take(1));\n }\n\n waitForStatus(nonce: number): Promise<void> {\n return this.eventsOfType<StatusEvent>('STATUS')\n .pipe(filter(event => event.nonce === nonce), take(1), map(event => {\n if (event.status) {\n return undefined;\n }\n throw new Error(event.error!);\n }))\n .toPromise();\n }\n\n get isEnabled(): boolean {\n return !!this.serviceWorker;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {merge, NEVER, Observable, Subject} from 'rxjs';\nimport {map, switchMap, take} from 'rxjs/operators';\n\nimport {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level';\n\n\n/**\n * Subscribe and listen to\n * [Web Push\n * Notifications](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) through\n * Angular Service Worker.\n *\n * @usageNotes\n *\n * You can inject a `SwPush` instance into any component or service\n * as a dependency.\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"inject-sw-push\"\n * header=\"app.component.ts\"></code-example>\n *\n * To subscribe, call `SwPush.requestSubscription()`, which asks the user for permission.\n * The call returns a `Promise` with a new\n * [`PushSubscription`](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * instance.\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"subscribe-to-push\"\n * header=\"app.component.ts\"></code-example>\n *\n * A request is rejected if the user denies permission, or if the browser\n * blocks or does not support the Push API or ServiceWorkers.\n * Check `SwPush.isEnabled` to confirm status.\n *\n * Invoke Push Notifications by pushing a message with the following payload.\n *\n * ```ts\n * {\n * \"notification\": {\n * \"actions\": NotificationAction[],\n * \"badge\": USVString,\n * \"body\": DOMString,\n * \"data\": any,\n * \"dir\": \"auto\"|\"ltr\"|\"rtl\",\n * \"icon\": USVString,\n * \"image\": USVString,\n * \"lang\": DOMString,\n * \"renotify\": boolean,\n * \"requireInteraction\": boolean,\n * \"silent\": boolean,\n * \"tag\": DOMString,\n * \"timestamp\": DOMTimeStamp,\n * \"title\": DOMString,\n * \"vibrate\": number[]\n * }\n * }\n * ```\n *\n * Only `title` is required. See `Notification`\n * [instance\n * properties](https://developer.mozilla.org/en-US/docs/Web/API/Notification#Instance_properties).\n *\n * While the subscription is active, Service Worker listens for\n * [PushEvent](https://developer.mozilla.org/en-US/docs/Web/API/PushEvent)\n * occurrences and creates\n * [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification)\n * instances in response.\n *\n * Unsubscribe using `SwPush.unsubscribe()`.\n *\n * An application can subscribe to `SwPush.notificationClicks` observable to be notified when a user\n * clicks on a notification. For example:\n *\n * <code-example path=\"service-worker/push/module.ts\" region=\"subscribe-to-notification-clicks\"\n * header=\"app.component.ts\"></code-example>\n *\n * You can read more on handling notification clicks in the [Service worker notifications\n * guide](guide/service-worker-notifications).\n *\n * @see [Push Notifications](https://developers.google.com/web/fundamentals/codelabs/push-notifications/)\n * @see [Angular Push Notifications](https://blog.angular-university.io/angular-push-notifications/)\n * @see [MDN: Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API)\n * @see [MDN: Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API)\n * @see [MDN: Web Push API Notifications best practices](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices)\n *\n * @publicApi\n */\n@Injectable()\nexport class SwPush {\n /**\n * Emits the payloads of the received push notification messages.\n */\n readonly messages: Observable<object>;\n\n /**\n * Emits the payloads of the received push notification messages as well as the action the user\n * interacted with. If no action was used the `action` property contains an empty string `''`.\n *\n * Note that the `notification` property does **not** contain a\n * [Notification][Mozilla Notification] object but rather a\n * [NotificationOptions](https://notifications.spec.whatwg.org/#dictdef-notificationoptions)\n * object that also includes the `title` of the [Notification][Mozilla Notification] object.\n *\n * [Mozilla Notification]: https://developer.mozilla.org/en-US/docs/Web/API/Notification\n */\n readonly notificationClicks: Observable<{\n action: string; notification: NotificationOptions &\n {\n title: string\n }\n }>;\n\n /**\n * Emits the currently active\n * [PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * associated to the Service Worker registration or `null` if there is no subscription.\n */\n readonly subscription: Observable<PushSubscription|null>;\n\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled(): boolean {\n return this.sw.isEnabled;\n }\n\n // TODO(issue/24571): remove '!'.\n private pushManager!: Observable<PushManager>;\n private subscriptionChanges = new Subject<PushSubscription|null>();\n\n constructor(private sw: NgswCommChannel) {\n if (!sw.isEnabled) {\n this.messages = NEVER;\n this.notificationClicks = NEVER;\n this.subscription = NEVER;\n return;\n }\n\n this.messages = this.sw.eventsOfType<PushEvent>('PUSH').pipe(map(message => message.data));\n\n this.notificationClicks =\n this.sw.eventsOfType('NOTIFICATION_CLICK').pipe(map((message: any) => message.data));\n\n this.pushManager = this.sw.registration.pipe(map(registration => registration.pushManager));\n\n const workerDrivenSubscriptions = this.pushManager.pipe(switchMap(pm => pm.getSubscription()));\n this.subscription = merge(workerDrivenSubscriptions, this.subscriptionChanges);\n }\n\n /**\n * Subscribes to Web Push Notifications,\n * after requesting and receiving user permission.\n *\n * @param options An object containing the `serverPublicKey` string.\n * @returns A Promise that resolves to the new subscription object.\n */\n requestSubscription(options: {serverPublicKey: string}): Promise<PushSubscription> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const pushOptions: PushSubscriptionOptionsInit = {userVisibleOnly: true};\n let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));\n let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));\n for (let i = 0; i < key.length; i++) {\n applicationServerKey[i] = key.charCodeAt(i);\n }\n pushOptions.applicationServerKey = applicationServerKey;\n\n return this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1))\n .toPromise()\n .then(sub => {\n this.subscriptionChanges.next(sub);\n return sub;\n });\n }\n\n /**\n * Unsubscribes from Service Worker push notifications.\n *\n * @returns A Promise that is resolved when the operation succeeds, or is rejected if there is no\n * active subscription or the unsubscribe operation fails.\n */\n unsubscribe(): Promise<void> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n\n const doUnsubscribe = (sub: PushSubscription|null) => {\n if (sub === null) {\n throw new Error('Not subscribed to push notifications.');\n }\n\n return sub.unsubscribe().then(success => {\n if (!success) {\n throw new Error('Unsubscribe failed!');\n }\n\n this.subscriptionChanges.next(null);\n });\n };\n\n return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise();\n }\n\n private decodeBase64(input: string): string {\n return atob(input);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {NEVER, Observable} from 'rxjs';\n\nimport {ERR_SW_NOT_SUPPORTED, NgswCommChannel, UnrecoverableStateEvent, UpdateActivatedEvent, UpdateAvailableEvent} from './low_level';\n\n\n\n/**\n * Subscribe to update notifications from the Service Worker, trigger update\n * checks, and forcibly activate updates.\n *\n * @see {@link guide/service-worker-communications Service worker communication guide}\n *\n * @publicApi\n */\n@Injectable()\nexport class SwUpdate {\n /**\n * Emits an `UpdateAvailableEvent` event whenever a new app version is available.\n */\n readonly available: Observable<UpdateAvailableEvent>;\n\n /**\n * Emits an `UpdateActivatedEvent` event whenever the app has been updated to a new version.\n */\n readonly activated: Observable<UpdateActivatedEvent>;\n\n /**\n * Emits an `UnrecoverableStateEvent` event whenever the version of the app used by the service\n * worker to serve this client is in a broken state that cannot be recovered from without a full\n * page reload.\n */\n readonly unrecoverable: Observable<UnrecoverableStateEvent>;\n\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled(): boolean {\n return this.sw.isEnabled;\n }\n\n constructor(private sw: NgswCommChannel) {\n if (!sw.isEnabled) {\n this.available = NEVER;\n this.activated = NEVER;\n this.unrecoverable = NEVER;\n return;\n }\n this.available = this.sw.eventsOfType<UpdateAvailableEvent>('UPDATE_AVAILABLE');\n this.activated = this.sw.eventsOfType<UpdateActivatedEvent>('UPDATE_ACTIVATED');\n this.unrecoverable = this.sw.eventsOfType<UnrecoverableStateEvent>('UNRECOVERABLE_STATE');\n }\n\n checkForUpdate(): Promise<void> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const statusNonce = this.sw.generateNonce();\n return this.sw.postMessageWithStatus('CHECK_FOR_UPDATES', {statusNonce}, statusNonce);\n }\n\n activateUpdate(): Promise<void> {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const statusNonce = this.sw.generateNonce();\n return this.sw.postMessageWithStatus('ACTIVATE_UPDATE', {statusNonce}, statusNonce);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {isPlatformBrowser} from '@angular/common';\nimport {APP_INITIALIZER, ApplicationRef, InjectionToken, Injector, ModuleWithProviders, NgModule, NgZone, PLATFORM_ID} from '@angular/core';\nimport {merge, Observable, of} from 'rxjs';\nimport {delay, filter, take} from 'rxjs/operators';\n\nimport {NgswCommChannel} from './low_level';\nimport {SwPush} from './push';\nimport {SwUpdate} from './update';\n\n/**\n * Token that can be used to provide options for `ServiceWorkerModule` outside of\n * `ServiceWorkerModule.register()`.\n *\n * You can use this token to define a provider that generates the registration options at runtime,\n * for example via a function call:\n *\n * {@example service-worker/registration-options/module.ts region=\"registration-options\"\n * header=\"app.module.ts\"}\n *\n * @publicApi\n */\nexport abstract class SwRegistrationOptions {\n /**\n * Whether the ServiceWorker will be registered and the related services (such as `SwPush` and\n * `SwUpdate`) will attempt to communicate and interact with it.\n *\n * Default: true\n */\n enabled?: boolean;\n\n /**\n * A URL that defines the ServiceWorker's registration scope; that is, what range of URLs it can\n * control. It will be used when calling\n * [ServiceWorkerContainer#register()](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n */\n scope?: string;\n\n /**\n * Defines the ServiceWorker registration strategy, which determines when it will be registered\n * with the browser.\n *\n * The default behavior of registering once the application stabilizes (i.e. as soon as there are\n * no pending micro- and macro-tasks) is designed to register the ServiceWorker as soon as\n * possible but without affecting the application's first time load.\n *\n * Still, there might be cases where you want more control over when the ServiceWorker is\n * registered (for example, there might be a long-running timeout or polling interval, preventing\n * the app from stabilizing). The available option are:\n *\n * - `registerWhenStable:<timeout>`: Register as soon as the application stabilizes (no pending\n * micro-/macro-tasks) but no later than `<timeout>` milliseconds. If the app hasn't\n * stabilized after `<timeout>` milliseconds (for example, due to a recurrent asynchronous\n * task), the ServiceWorker will be registered anyway.\n * If `<timeout>` is omitted, the ServiceWorker will only be registered once the app\n * stabilizes.\n * - `registerImmediately`: Register immediately.\n * - `registerWithDelay:<timeout>`: Register with a delay of `<timeout>` milliseconds. For\n * example, use `registerWithDelay:5000` to register the ServiceWorker after 5 seconds. If\n * `<timeout>` is omitted, is defaults to `0`, which will register the ServiceWorker as soon\n * as possible but still asynchronously, once all pending micro-tasks are completed.\n * - An [Observable](guide/observables) factory function: A function that returns an `Observable`.\n * The function will be used at runtime to obtain and subscribe to the `Observable` and the\n * ServiceWorker will be registered as soon as the first value is emitted.\n *\n * Default: 'registerWhenStable:30000'\n */\n registrationStrategy?: string|(() => Observable<unknown>);\n}\n\nexport const SCRIPT = new InjectionToken<string>('NGSW_REGISTER_SCRIPT');\n\nexport function ngswAppInitializer(\n injector: Injector, script: string, options: SwRegistrationOptions,\n platformId: string): Function {\n const initializer = () => {\n if (!(isPlatformBrowser(platformId) && ('serviceWorker' in navigator) &&\n options.enabled !== false)) {\n return;\n }\n\n // Wait for service worker controller changes, and fire an INITIALIZE action when a new SW\n // becomes active. This allows the SW to initialize itself even if there is no application\n // traffic.\n navigator.serviceWorker.addEventListener('controllerchange', () => {\n if (navigator.serviceWorker.controller !== null) {\n navigator.serviceWorker.controller.postMessage({action: 'INITIALIZE'});\n }\n });\n\n let readyToRegister$: Observable<unknown>;\n\n if (typeof options.registrationStrategy === 'function') {\n readyToRegister$ = options.registrationStrategy();\n } else {\n const [strategy, ...args] =\n (options.registrationStrategy || 'registerWhenStable:30000').split(':');\n\n switch (strategy) {\n case 'registerImmediately':\n readyToRegister$ = of(null);\n break;\n case 'registerWithDelay':\n readyToRegister$ = delayWithTimeout(+args[0] || 0);\n break;\n case 'registerWhenStable':\n readyToRegister$ = !args[0] ? whenStable(injector) :\n merge(whenStable(injector), delayWithTimeout(+args[0]));\n break;\n default:\n // Unknown strategy.\n throw new Error(\n `Unknown ServiceWorker registration strategy: ${options.registrationStrategy}`);\n }\n }\n\n // Don't return anything to avoid blocking the application until the SW is registered.\n // Also, run outside the Angular zone to avoid preventing the app from stabilizing (especially\n // given that some registration strategies wait for the app to stabilize).\n // Catch and log the error if SW registration fails to avoid uncaught rejection warning.\n const ngZone = injector.get(NgZone);\n ngZone.runOutsideAngular(\n () => readyToRegister$.pipe(take(1)).subscribe(\n () =>\n navigator.serviceWorker.register(script, {scope: options.scope})\n .catch(err => console.error('Service worker registration failed with:', err))));\n };\n return initializer;\n}\n\nfunction delayWithTimeout(timeout: number): Observable<unknown> {\n return of(null).pipe(delay(timeout));\n}\n\nfunction whenStable(injector: Injector): Observable<unknown> {\n const appRef = injector.get(ApplicationRef);\n return appRef.isStable.pipe(filter(stable => stable));\n}\n\nexport function ngswCommChannelFactory(\n opts: SwRegistrationOptions, platformId: string): NgswCommChannel {\n return new NgswCommChannel(\n isPlatformBrowser(platformId) && opts.enabled !== false ? navigator.serviceWorker :\n undefined);\n}\n\n/**\n * @publicApi\n */\n@NgModule({\n providers: [SwPush, SwUpdate],\n})\nexport class ServiceWorkerModule {\n /**\n * Register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n */\n static register(script: string, opts: SwRegistrationOptions = {}):\n ModuleWithProviders<ServiceWorkerModule> {\n return {\n ngModule: ServiceWorkerModule,\n providers: [\n {provide: SCRIPT, useValue: script},\n {provide: SwRegistrationOptions, useValue: opts},\n {\n provide: NgswCommChannel,\n useFactory: ngswCommChannelFactory,\n deps: [SwRegistrationOptions, PLATFORM_ID]\n },\n {\n provide: APP_INITIALIZER,\n useFactory: ngswAppInitializer,\n deps: [Injector, SCRIPT, SwRegistrationOptions, PLATFORM_ID],\n multi: true,\n },\n ],\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport {UnrecoverableStateEvent, UpdateActivatedEvent, UpdateAvailableEvent} from './low_level';\nexport {ServiceWorkerModule, SwRegistrationOptions} from './module';\nexport {SwPush} from './push';\nexport {SwUpdate} from './update';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/index';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAWO,MAAM,oBAAoB,GAAG,+DAA+D,CAAC;AAoEpG,SAAS,eAAe,CAAC,OAAe;IACtC,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;MAGa,eAAe;IAO1B,YAAoB,aAA+C;QAA/C,kBAAa,GAAb,aAAa,CAAkC;QACjE,IAAI,CAAC,aAAa,EAAE;YAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;SACvF;aAAM;YACL,MAAM,sBAAsB,GAAG,SAAS,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;YAC5E,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;YAC3F,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;YACpE,MAAM,qBAAqB,GAAG,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;YAE3E,IAAI,CAAC,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,IACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC;YAExE,MAAM,SAAS,GAAG,SAAS,CAAe,aAAa,EAAE,SAAS,CAAC,CAAC;YACpE,MAAM,eAAe,GAAG,S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