Skip to content
Source
Sign inSign up
Open History to see the last commit

snapShotSetupResume.ts

29 lines916 Bytes

1const STORAGE_KEY = "t3code:snap-shot-setup-resume:v1";
2let startupChecked = false;
3​
4export function readSnapShotSetupResume(): { wasEnabled: boolean } | null {
5 try {
6 const value = window.localStorage.getItem(STORAGE_KEY);
7 if (value === "enabled" || value === "disabled") return { wasEnabled: value === "enabled" };
8 } catch {}
9 return null;
11​
12export function saveSnapShotSetupResume(wasEnabled: boolean): void {
13 try {
14 window.localStorage.setItem(STORAGE_KEY, wasEnabled ? "enabled" : "disabled");
15 } catch {}
17​
18export function clearSnapShotSetupResume(): void {
19 try {
20 window.localStorage.removeItem(STORAGE_KEY);
21 } catch {}
23​
24// Check once per startup so opening System Settings cannot redirect later navigation.
25export function shouldResumeSnapShotSetupOnStartup(): boolean {
26 if (startupChecked) return false;
27 startupChecked = true;
28 return readSnapShotSetupResume() !== null;