// A one-line notice for the site-wide toast (components/DemoToast.jsx), for the // rare moment a screen has to say something after it has navigated away — the // account page cannot show "Your account has been deleted." on itself, because // the account it would be shown on no longer exists. // // The same shape as lib/demoNotice.js and drawn by the same toast, so the site // has one place a passing message appears. const listeners = new Set() /** Subscribe to notices. Returns the unsubscribe function. */ export function onNotice(fn) { listeners.add(fn) return () => listeners.delete(fn) } /** Show one notice. */ export function showNotice(message) { if (typeof message !== 'string' || !message) return for (const fn of listeners) { try { fn(message) } catch { // A broken listener must not stop the caller. } } }