diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-22 14:15:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-22 14:15:23 +0100 |
commit | 78967fca4cacbc247fa6fb62d64b2d6825a10804 (patch) | |
tree | f063a82b0658005e3d5ce23648333805782155ed /client/src/main.ts | |
parent | 93df58cc4865af9046d2b31e03fa37d3ae54e45b (diff) | |
download | PeerTube-78967fca4cacbc247fa6fb62d64b2d6825a10804.tar.gz PeerTube-78967fca4cacbc247fa6fb62d64b2d6825a10804.tar.zst PeerTube-78967fca4cacbc247fa6fb62d64b2d6825a10804.zip |
Register service worker
Diffstat (limited to 'client/src/main.ts')
-rw-r--r-- | client/src/main.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/main.ts b/client/src/main.ts index b02b6830f..9686ba4b8 100644 --- a/client/src/main.ts +++ b/client/src/main.ts | |||
@@ -12,6 +12,19 @@ if (environment.production) { | |||
12 | 12 | ||
13 | const bootstrap = () => platformBrowserDynamic() | 13 | const bootstrap = () => platformBrowserDynamic() |
14 | .bootstrapModule(AppModule) | 14 | .bootstrapModule(AppModule) |
15 | .then(bootstrapModule => { | ||
16 | // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed? | ||
17 | if ('serviceWorker' in navigator && environment.production) { | ||
18 | navigator.serviceWorker.register('/ngsw-worker.js') | ||
19 | .catch(err => console.error('Cannot register service worker.', err)) | ||
20 | } | ||
21 | |||
22 | return bootstrapModule | ||
23 | }) | ||
24 | .catch(err => { | ||
25 | console.error(err) | ||
26 | return null | ||
27 | }) | ||
15 | 28 | ||
16 | if (environment.hmr) { | 29 | if (environment.hmr) { |
17 | if (module[ 'hot' ]) { | 30 | if (module[ 'hot' ]) { |