Files
2026-10-29 11:57:29 +01:00

26 lines
852 B
JavaScript

// Generated, do not edit. sha256:8c2d29dc1ab4de132603fd0dc064664fee50070f3e3eb2720a5819c260fc1066
import { CONFIG } from '../../shared/config.js';
export function setRowFocus(table, id) {
if (!table || id == null) return;
try {
sessionStorage.setItem(CONFIG.FOCUS.ROW, JSON.stringify({ table, id, at: Date.now() }));
} catch { }
}
export function takeRowFocus(table) {
let raw;
try { raw = sessionStorage.getItem(CONFIG.FOCUS.ROW); } catch { return null; }
if (!raw) return null;
let data;
try { data = JSON.parse(raw); } catch { remove(); return null; }
if (!data || data.table !== table) return null;
remove();
if (!Number.isFinite(data.at) || Date.now() - data.at > CONFIG.FOCUS.ROW_TTL_MS) return null;
return data.id ?? null;
}
function remove() {
try { sessionStorage.removeItem(CONFIG.FOCUS.ROW); } catch { }
}