Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

605 B
Raw Blame
// Best-effort access to Web Storage. Reading the `localStorage` /
// `sessionStorage` globals can throw (SSR, storage disabled, sandboxed or
// partitioned browsing contexts), so callers get `null` instead of an
// exception — telemetry must never break Studio.

export function safeLocalStorage(): Storage | null {
  try {
    return typeof localStorage === "undefined" ? null : localStorage;
  } catch {
    return null;
  }
}

export function safeSessionStorage(): Storage | null {
  try {
    return typeof sessionStorage === "undefined" ? null : sessionStorage;
  } catch {
    return null;
  }
}