From 8ea5ad385f4a308913866609dcbf8c782de2b7ae Mon Sep 17 00:00:00 2001 From: bat Date: Sun, 9 Apr 2023 07:02:12 +0000 Subject: [PATCH] Run with or without sandbox --- app.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index aad8bcb..78bbbea 100644 --- a/app.js +++ b/app.js @@ -19,18 +19,28 @@ customElements.define( ) class Setup { - async run() { - const sw = navigator.serviceWorker - - sw.addEventListener('controllerchange', () => { - if (this.registration.active) { - window.location.reload(true) + async runWithSw() { + navigator.serviceWorker.addEventListener( + 'controllerchange', + () => { + if (this.registration.active) { + window.location.reload(true) + } } - }) + ) await this.register() this.load() } + async runWithoutSw() { + const layout = document.createElement( + 'm-layout' + ) + layout.csp = undefined + layout.header.menu.handleLinks = true + document.body.appendChild(layout) + } + async register() { try { this.registration = @@ -54,4 +64,4 @@ class Setup { } } -new Setup().run() \ No newline at end of file +new Setup().runWithSw() \ No newline at end of file