parent
d195406fdc
commit
ebedb81e3f
@ -8,14 +8,15 @@ import {
|
|||||||
|
|
||||||
const fallbackName = (key: string) => `idbfallback::${key}`;
|
const fallbackName = (key: string) => `idbfallback::${key}`;
|
||||||
|
|
||||||
let idbAvailable = typeof window !== 'undefined' ? !!window.indexedDB : true;
|
let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && window.indexedDB.open) : true;
|
||||||
|
|
||||||
if (idbAvailable) {
|
if (idbAvailable) {
|
||||||
iset('idb-test', 'test').catch(err => {
|
await iset('idb-test', 'test')
|
||||||
console.error('idb error', err);
|
.catch(err => {
|
||||||
console.error('indexedDB is unavailable. It will use localStorage.');
|
console.error('idb error', err);
|
||||||
idbAvailable = false;
|
console.error('indexedDB is unavailable. It will use localStorage.');
|
||||||
});
|
idbAvailable = false;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error('indexedDB is unavailable. It will use localStorage.');
|
console.error('indexedDB is unavailable. It will use localStorage.');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user