Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created September 2, 2022 19:10
Show Gist options
  • Save robwormald/f3b21763370278ed82471e1b498fbbe1 to your computer and use it in GitHub Desktop.
Save robwormald/f3b21763370278ed82471e1b498fbbe1 to your computer and use it in GitHub Desktop.
customElements.define('app-shell', class extends HTMLElement {
constructor(){
super();
this.attachShadow({mode: 'open'});
this.shadowRoot.innerHTML = `
<h1>App</h1>
<slot></slot>
`
}
});
customElements.define('home-page', class extends HTMLElement {
constructor(){
super();
this.attachShadow({mode: 'open'});
this.shadowRoot.innerHTML = `
<h1>Home</h1>
<slot></slot>
`
}
});
customElements.define('about-page', class extends HTMLElement {
constructor(){
super();
this.attachShadow({mode: 'open'});
this.shadowRoot.innerHTML = `
<h1>About</h1>
<slot></slot>
`
}
});
<app-shell></app-shell>
{
name: 'home',
component: 'home-page',
url: 'home'
}
{
name: 'about',
component: 'about-page',
url: 'home'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment