class OSTaskbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
00:00
`;
// Update clock
const updateClock = () => {
const now = new Date();
this.shadowRoot.getElementById('clock').textContent =
`${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`;
};
updateClock();
setInterval(updateClock, 60000);
this.shadowRoot.querySelectorAll('.taskbar-app').forEach(icon => {
icon.addEventListener('click', () => {
const app = icon.getAttribute('data-app');
this.dispatchEvent(new CustomEvent('open-app', {
detail: { app },
bubbles: true,
composed: true
}));
});
});
setTimeout(() => feather.replace(), 100);
}
}
customElements.define('os-taskbar', OSTaskbar);