21 lines
811 B
TypeScript
21 lines
811 B
TypeScript
// Per-tab "does the site think it has an active session" hint, reported by
|
|
// the SDK's session_status message. Advisory only — see types.ts's
|
|
// SessionStatusMessage comment. In-memory only, same lifecycle as
|
|
// sdk-ports.ts's Port map: lost on service worker restart, which just
|
|
// means the popup shows the plain idle screen until the site re-reports
|
|
// (harmless — it's a UI hint, nothing depends on it surviving).
|
|
|
|
const sessionActiveByTab = new Map<number, boolean>();
|
|
|
|
export function setSessionActive(tabId: number, active: boolean): void {
|
|
sessionActiveByTab.set(tabId, active);
|
|
}
|
|
|
|
export function getSessionActive(tabId: number): boolean {
|
|
return sessionActiveByTab.get(tabId) ?? false;
|
|
}
|
|
|
|
export function clearSessionActive(tabId: number): void {
|
|
sessionActiveByTab.delete(tabId);
|
|
}
|