evcc-io/assets/js/utils/remote.ts
2026-04-13 20:21:33 +00:00

10 lines
311 B
TypeScript

const ACTIVE_THRESHOLD_MS = 5 * 60 * 1000; // 5 minutes
export function isRemoteClientActive(
lastSeen: Record<string, string> | undefined,
username: string
): boolean {
const seen = lastSeen?.[username];
if (!seen) return false;
return Date.now() - new Date(seen).getTime() < ACTIVE_THRESHOLD_MS;
}