update idb-proxy.ts

Maybe fixed #9769
This commit is contained in:
tamaina 2023-02-03 08:07:17 +00:00
parent d195406fdc
commit ebedb81e3f

View file

@ -8,14 +8,15 @@ import {
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) {
iset('idb-test', 'test').catch(err => {
console.error('idb error', err);
console.error('indexedDB is unavailable. It will use localStorage.');
idbAvailable = false;
});
await iset('idb-test', 'test')
.catch(err => {
console.error('idb error', err);
console.error('indexedDB is unavailable. It will use localStorage.');
idbAvailable = false;
});
} else {
console.error('indexedDB is unavailable. It will use localStorage.');
}