mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-11-13 17:08:20 +00:00
13 lines
311 B
TypeScript
13 lines
311 B
TypeScript
export function storage(): Storage | null {
|
|
return typeof localStorage === "undefined" ? null : localStorage;
|
|
}
|
|
|
|
// setItem throws in privacy modes; persistence is best-effort.
|
|
export function safeSetItem(key: string, value: string): void {
|
|
try {
|
|
storage()?.setItem(key, value);
|
|
} catch {
|
|
// ignore
|
|
}
|
|
}
|