Versie 0.2.0
This commit is contained in:
commit
e77d8fd373
495 files changed
+81026
No files matched your search
@@ -0,0 +1,25 @@
|
||||
// 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 { }
|
||||
}
|
||||
Reference in new issue
Block a user