forked from mystiq/hydrogen-web
WIP
This commit is contained in:
parent
eaa31eb8fb
commit
e40d74ebce
2 changed files with 6 additions and 1 deletions
5
src/platform/types/Platform.d.ts
vendored
5
src/platform/types/Platform.d.ts
vendored
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue