diff --git a/app.js b/app.js index dbef624..b6c5ac4 100644 --- a/app.js +++ b/app.js @@ -1,21 +1,19 @@ +import { Layout } from "./components/layout.js" import { Project } from "./components/project.js" +customElements.define('m-layout', Layout) customElements.define('m-project', Project) class Setup { - constructor() { - this.loaded = false - } - async run() { navigator.serviceWorker .addEventListener('controllerchange', () => { if (this.registration.active) { - this.loadIfReady() + window.location.reload(true) } }) await this.register() - this.loadIfReady() + this.load() } async register() { @@ -32,14 +30,11 @@ class Setup { } } - loadIfReady() { - if ( - !this.loaded && this.registration.active - ) { + load() { + if (this.registration.active) { document.body.appendChild( - document.createElement('m-project') + document.createElement('m-layout') ) - this.loaded = true } } }