import { t } from '../i18n/index.js'; /** * Keep the clear action focusable while busy; the caller owns its * transaction. The globe actions view renders the button from the globe * actions store now; this stays exported from `./ui/layers` for hosts that * imported it. * @deprecated */ export function bindClearLayersControl(button, clear) { let destroyed = false; const click = () => { if (!destroyed) void clear(); }; button?.addEventListener('click', click); return { setBusy(busy) { if (destroyed || !button) return; button.setAttribute('aria-disabled', String(busy)); button.setAttribute('aria-busy', String(busy)); button.setAttribute( 'aria-label', busy ? t('Clearing selected data layers') : t('Clear selected data layers'), ); }, destroy() { destroyed = true; button?.removeEventListener('click', click); }, }; }