npm install delph
cd examples/one
npm run dev
none!
import { Delph } from 'delph'
constructor(){
const page = window.location.pathname.substr(1) || ''
const main = document.getElementById('main')
this.delph = new Delph(routes, main, page)
}
Delph takes in a Routes object, an element to append to, and the current url
const routes = {
about: AboutComponent,
'' : DefaultComponent
}
export class DefaultComponent extends HTMLElement {
connectedCallback() {
this.render();
}
render() {
this.innerHTML = (`i am the homepage`)
}
}
customElements.define('default-component', DefaultComponent);