set up instance of storage class

main
bat 3 years ago
parent 8696ad8228
commit b66e298ac8

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

Loading…
Cancel
Save