diff --git a/app.js b/app.js index 4c1d543..0bb0f72 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,4 @@ +import { Storage } from "/storage/storage.js" import { Layout } from "/components/layout.js" import { Page } from "/components/page.js" import { PageActions } from "/components/page-actions.js" @@ -41,6 +42,13 @@ customElements.define( ) class Setup { + constructor() { + this.layout = document.createElement( + 'm-layout' + ) + this.layout.storage = new Storage() + } + async runWithSw() { navigator.serviceWorker.addEventListener( 'controllerchange', @@ -55,12 +63,10 @@ class Setup { } async runWithoutSw() { - const layout = document.createElement( - 'm-layout' - ) - layout.csp = undefined - layout.header.menu.handleLinks = true - document.body.appendChild(layout) + this.layout.storage = new Storage() + this.layout.csp = undefined + this.layout.header.menu.handleLinks = true + document.body.appendChild(this.layout) } async register() { @@ -83,7 +89,7 @@ class Setup { load() { if (this.registration.active) { document.body.appendChild( - document.createElement('m-layout') + this.layout ) } }