Files
gods-eye-view/src/ui/clearLayersControl.js
T
Sameh Khamis 7edf8a577e feat(globe): answer the clear and share actions through the globe actions store
The top-center bar is now GlobeActions.vue. The shell publishes whether a
clear is under way and answers the clear and share buttons through the
globe actions store, instead of binding listeners and writing attributes on
the buttons. A shell disposed mid-clear resets the busy state, so the next
shell's bar is not left busy. bindClearLayersControl stays exported and is
deprecated.
2026-11-01 13:23:51 -08:00

34 lines
940 B
JavaScript

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);
},
};
}