From e40d74ebce3b7aea449ce20b36399775e4f6a7f4 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 18 Nov 2021 15:21:38 +0530 Subject: [PATCH] WIP --- src/platform/types/Platform.d.ts | 5 +++++ src/platform/web/Platform.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/types/Platform.d.ts b/src/platform/types/Platform.d.ts index b3de65cc..0dd6ad48 100644 --- a/src/platform/types/Platform.d.ts +++ b/src/platform/types/Platform.d.ts @@ -19,6 +19,7 @@ import type {SettingsStorage} from "../web/dom/SettingsStorage.js"; import type {Clock} from "../web/dom/Clock.js"; import type {History} from "../web/dom/History.js"; import type {OnlineStatus} from "../web/dom/OnlineStatus.js"; +import type {ServiceWorkerHandler} from "../web/dom/ServiceWorkerHandler.js"; import type {Encoding} from "../web/utils/Encoding.js"; export interface IPlatformConfig { @@ -30,6 +31,9 @@ export interface IPlatformConfig { wasm: string; legacyBundle: string; wasmBundle: string; + }; + push: { + } } @@ -50,4 +54,5 @@ export interface IPlatform { readonly random: () => number; readonly history: History; readonly onlineStatus: OnlineStatus; + readonly updateService?: ServiceWorkerHandler; } diff --git a/src/platform/web/Platform.ts b/src/platform/web/Platform.ts index 59e20b32..f645d6c4 100644 --- a/src/platform/web/Platform.ts +++ b/src/platform/web/Platform.ts @@ -136,6 +136,7 @@ export class Platform implements IPlatform { public readonly onlineStatus: OnlineStatus = new OnlineStatus(); private readonly _config: IPlatformConfig; private readonly _container: HTMLElement; + private readonly _serviceWorkerHandler?: ServiceWorkerHandler; constructor(container: HTMLElement, config: IPlatformConfig, cryptoExtras = null, options?: IPlatformOptions) { this._config = config; @@ -145,7 +146,6 @@ export class Platform implements IPlatform { } else { this.logger = new IDBLogger({name: "hydrogen_logs", platform: this}); } - this._serviceWorkerHandler = null; if (config.serviceWorker && "serviceWorker" in navigator) { this._serviceWorkerHandler = new ServiceWorkerHandler(); this._serviceWorkerHandler.registerAndStart(config.serviceWorker);