Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

691 B
Raw Blame
/*
 * The switches of the trip PDF preview (a new page for every day, the notes of
 * the transports, large text), remembered in this browser.
 */

/** A preview switch as it was last left; `defaultOn` until it is first touched, or when storage is blocked. */
export function pdfSwitchOn(key: string, defaultOn = true): boolean {
  try {
    const stored = localStorage.getItem(key);
    return stored === null ? defaultOn : stored !== '0';
  } catch {
    return defaultOn;
  }
}

export function rememberPdfSwitch(key: string, on: boolean): void {
  try {
    localStorage.setItem(key, on ? '1' : '0');
  } catch {
    // A blocked localStorage costs the preference, not the export.
  }
}