UNPKG

kompendium

Version:

Documentation generator for Stencil components

31 lines (28 loc) 763 B
import { r as registerInstance, h } from './index-3601b4dc.js'; const Guide = class { constructor(hostRef) { registerInstance(this, hostRef); this.setRoute = this.setRoute.bind(this); } connectedCallback() { window.addEventListener('hashchange', this.setRoute); this.setRoute(); } disconnectedCallback() { window.removeEventListener('hashchange', this.setRoute); } setRoute() { this.route = location.hash.replace('#', ''); } render() { this.findGuide(); return h("kompendium-markdown", { text: this.text }); } findGuide() { const guide = this.data.guides.find((g) => g.data.path + '/' === this.route); if (guide) { this.text = guide.content; } } }; export { Guide as kompendium_guide };