import { $, h } from './dom.js'; const DURATION_MS = 6000; const MAX_VISIBLE = 3; // a big jump (import, long absence) must not bury the page in messages export function showToast(message, { error = false } = {}) { const container = $('#toasts'); const toast = h('p', { class: error ? 'toast toast--error' : 'toast', text: message }); container.append(toast); while (container.children.length > MAX_VISIBLE) container.firstElementChild.remove(); setTimeout(() => toast.remove(), DURATION_MS); }