Actualizar 'app.js'

file-group-page
bat 3 years ago
parent 0fb1ef4932
commit 9f9c236959

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

Loading…
Cancel
Save