Tidy up Service Worker, only run Workbox in production
Moves ServiceWorker load into Platform so its not done by Electron Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
7b8010f23a
commit
c47532fe2a
3 changed files with 97 additions and 86 deletions
|
@ -28,11 +28,6 @@ require('highlight.js/styles/github.css');
|
|||
import {parseQsFromFragment} from "./url_utils";
|
||||
import './modernizr';
|
||||
|
||||
// load service worker if available on this platform
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
}
|
||||
|
||||
async function settled(...promises: Array<Promise<any>>) {
|
||||
for (const prom of promises) {
|
||||
try {
|
||||
|
|
|
@ -34,6 +34,17 @@ const POKE_RATE_MS = 10 * 60 * 1000; // 10 min
|
|||
export default class WebPlatform extends VectorBasePlatform {
|
||||
private runningVersion: string = null;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// load service worker if available on this platform
|
||||
// Service worker is disabled in development: https://github.com/GoogleChrome/workbox/issues/1790
|
||||
if ('serviceWorker' in navigator && process.env.NODE_ENV === "production") {
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getHumanReadableName(): string {
|
||||
return 'Web Platform'; // no translation required: only used for analytics
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue