UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

22 lines (19 loc) 475 B
/** * Whether or not the current environment supports localStorage. * Checks that values can actually be set/removed, to trigger any privacy settings. * * @internal */ export const supportsLocalStorage = (() => { const key = '__tmp_supports_local_storage' try { if (typeof localStorage === 'undefined') { return false } localStorage.setItem(key, '---') localStorage.removeItem(key) return true } catch (err) { return false } })()