import { Layout } from "./components/layout.js" import { Project } from "./components/project.js" customElements.define('m-layout', Layout) customElements.define('m-project', Project) class Setup { async run() { navigator.serviceWorker .addEventListener('controllerchange', () => { if (this.registration.active) { window.location.reload(true) } }) await this.register() this.load() } async register() { try { this.registration = await navigator.serviceWorker.register( '/sw.js', {scope: '/'} ) } catch (err) { console.error( 'error registering service worker', err ) } } load() { if (this.registration.active) { document.body.appendChild( document.createElement('m-layout') ) } } } new Setup().run()