import './style.css'; import { INSTRUMENTS } from './instruments/registry'; const app = document.getElementById('app')!; function gallery() { app.innerHTML = `

Toy instruments

Idealized physical models you can configure, simulate and listen to. Pick an instrument.

`; document.title = 'Toy instruments'; } function route() { // #/, optionally ? from a shared link (the page reads and removes them) const id = location.hash.replace(/^#\/?/, '').split('?')[0]; const inst = INSTRUMENTS.find((i) => i.id === id && i.mount); window.scrollTo(0, 0); if (!inst) return gallery(); document.title = `${inst.name} ยท Toy instruments`; app.replaceChildren(); inst.mount!(app); } window.addEventListener('hashchange', route); route();