/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/data/src/plugins/persistence/storage/default.ts
17 строк
594 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import type { StorageInterface } from '../../../types'; import objectStorage from './object'; let storage: StorageInterface & { removeItem?: ( key: string ) => void }; try { // Private Browsing in Safari 10 and earlier will throw an error when // attempting to set into localStorage. The test here is intentional in // causing a thrown error as condition for using fallback object storage. storage = window.localStorage; storage.setItem( '__wpDataTestLocalStorage', '' ); storage.removeItem!( '__wpDataTestLocalStorage' ); } catch { storage = objectStorage; } export default storage;