export default async function ({emitter}){ class LinksComponent extends HTMLElement { constructor(...args) { const self = super(...args); const templateSelector = '#links-component'; const template = document.querySelector(templateSelector); const templateContent = template.content; const shadowRoot = this.attachShadow({mode: 'open'}); this.shadowRoot.appendChild(templateContent.cloneNode(true)); const content = this.shadowRoot.querySelector('ul'); const update = function(context){ content.innerHTML = ` ${context.locations.filter(location=>location.parent).map(location => `
  • «${location.label}
  • `).join('')} ${context.locations.filter(location=>location.active).map(location => `
  • ${location.label} (current)
  • `).join('')} ${context.locations.filter(location=>!location.parent).filter(location=>!location.active).map(location => `
  • ${location.label}
  • `).join('')} `; } emitter.on('navigation',(context)=>update(context)); return self; } } customElements.define('links-component', LinksComponent); return LinksComponent; }