mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 03:25:52 +01:00
Start the service worker before doing anything else
This commit is contained in:
parent
cab5fe98d1
commit
46f7a9b2a9
@ -144,7 +144,6 @@ export class Platform {
|
||||
this._serviceWorkerHandler = null;
|
||||
if (assetPaths.serviceWorker && "serviceWorker" in navigator) {
|
||||
this._serviceWorkerHandler = new ServiceWorkerHandler();
|
||||
this._serviceWorkerHandler.registerAndStart(assetPaths.serviceWorker);
|
||||
}
|
||||
this.notificationService = undefined;
|
||||
// Only try to use crypto when olm is provided
|
||||
@ -172,6 +171,12 @@ export class Platform {
|
||||
|
||||
async init() {
|
||||
try {
|
||||
if (this._serviceWorkerHandler instanceof ServiceWorkerHandler) {
|
||||
// Start the service worker before doing anything else,
|
||||
// to make sure all requests are intercepted by the service worker.
|
||||
await this._serviceWorkerHandler.registerAndStart(this._assetPaths.serviceWorker)
|
||||
}
|
||||
|
||||
await this.logger.run("Platform init", async (log) => {
|
||||
if (!this._config) {
|
||||
if (!this._configURL) {
|
||||
|
Loading…
Reference in New Issue
Block a user