This commit is contained in:
RMidhunSuresh 2021-11-18 15:21:38 +05:30
parent eaa31eb8fb
commit e40d74ebce
2 changed files with 6 additions and 1 deletions

View file

@ -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;
}

View file

@ -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);