Repository navigation
Expand file tree
/
Copy pathstate.js
More file actions
executable file
·59 lines (54 loc) · 2.69 KB
/
Copy pathstate.js
File metadata and controls
executable file
·59 lines (54 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { DEFAULT_SETTINGS } from './constants.js';
export let memoryBaselines = new Map();
export let globalSettings = { ...DEFAULT_SETTINGS };
export let lastActiveTabId = null;
export let isInitialized = false;
export let sessionVault = [];
export let vaultCanonicalUrls = new Set();
export let tabSets = {};
export let groupCache = new Map();
export let peekWindows = new Map();
// Tabs whose content script currently shows the peek parent-blur overlay.
// Tracked background-side so a lost remove-parent-blur message (discarded tab,
// content script unavailable) can be recovered via onActivated. Must be cleaned
// up in tabs.onRemoved and windows.onRemoved.
export let blurredSourceTabs = new Set();
export let evictionGraveyard = new Map();
export let recreationRegistry = new Map();
export let groupClosureTracker = new Set();
export let windowBatchTracker = new Map();
export let closingWindowIds = new Set();
export let autoGroupRegistry = new Map();
export let launchingWindowIds = new Set();
export let pendingLaunches = 0;
export function incrementPendingLaunches() { pendingLaunches++; }
export function decrementPendingLaunches() { if (pendingLaunches > 0) pendingLaunches--; }
export let ntpTabCache = new Map();
export let pomoTimer = { endTime: null, type: null, isActive: false };
export let discardedTabs = new Set();
export let recentlyAwakened = new Map();
export let pendingFocusGuardWindowIds = new Set();
// Windows where a protected-tab RESTORE is taking focus back (issue #10 bug 1)
export let pendingRestoreWindowIds = new Set();
export let savedPrompts = [];
// Tab snapshots for the Undo toast (close-other / clear-unprotected / batch archive).
// Memory-only by design: undo lives for seconds, SW death killing it is fine.
export let lastClosedTabs = [];
// Window that holds the auto-restored bookmarks (Auto-Restore Bookmarks).
export let bookmarkWindowId = null;
// Serial for the single undo slot — toasts carry it so stale Undo clicks
// (payload already replaced by a newer action) are rejected.
export let undoSerial = 0;
export function setLastActiveTabId(id) { lastActiveTabId = id; }
export function setInitialized(val) { isInitialized = val; }
export function setSessionVault(val) { sessionVault = val; }
export function setTabSets(val) { tabSets = val; }
export function setPomoTimer(val) { pomoTimer = val; }
export function setSavedPrompts(val) { savedPrompts = val; }
export function setLastClosedTabs(val) { lastClosedTabs = val; }
export function setBookmarkWindowId(val) { bookmarkWindowId = val; }
export function bumpUndoSerial() { return ++undoSerial; }
// Helper to update settings
export function updateSettings(newSettings) {
globalSettings = { ...globalSettings, ...newSettings };
}