mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
refactor: separate Layers panel presentation from lifecycle actions
This commit is contained in:
1 parent
31f1923633
commit
07cf1695ff
14 files changed
+665
-398
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/** Keep the clear action focusable while busy; the caller owns its transaction. */
|
||||
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 ? 'Clearing selected data layers' : 'Clear selected data layers');
|
||||
},
|
||||
destroy() {
|
||||
destroyed = true;
|
||||
button?.removeEventListener('click', click);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user