Add TS JSDoc coverage and improve numeric step controls

This commit is contained in:
Jage9
2026-02-22 17:12:28 -05:00
parent 3e321df56c
commit 5f1f1022fc
13 changed files with 63 additions and 10 deletions

View File

@@ -1,3 +1,6 @@
/**
* UI elements used by binder setup.
*/
type UiDom = {
connectButton: HTMLButtonElement;
preconnectNickname: HTMLInputElement;
@@ -11,6 +14,9 @@ type UiDom = {
canvas: HTMLCanvasElement;
};
/**
* Dependency contract for binding DOM event handlers.
*/
type UiBindingsDeps = {
dom: UiDom;
sanitizeName: (value: string) => string;
@@ -30,6 +36,9 @@ type UiBindingsDeps = {
persistOnUnload: () => void;
};
/**
* Attaches UI listeners (connect/settings/device changes) and focus traps.
*/
export function setupUiHandlers(deps: UiBindingsDeps): void {
window.addEventListener('pagehide', deps.persistOnUnload);
window.addEventListener('beforeunload', deps.persistOnUnload);