Spaces:
Paused
Paused
File size: 678 Bytes
4e7644b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | export const CLOSE_ACTION_STORAGE_KEY = "qwenpaw.closeWindowAction";
export type CloseAction = "minimize-to-tray" | "quit";
export function getRememberedCloseAction(): CloseAction | null {
const action = getStorage()?.getItem(CLOSE_ACTION_STORAGE_KEY);
return action === "minimize-to-tray" || action === "quit" ? action : null;
}
export function setRememberedCloseAction(action: CloseAction) {
getStorage()?.setItem(CLOSE_ACTION_STORAGE_KEY, action);
}
export function clearRememberedCloseAction() {
getStorage()?.removeItem(CLOSE_ACTION_STORAGE_KEY);
}
function getStorage(): Storage | null {
return typeof window === "undefined" ? null : window.localStorage;
}
|