Revert "Revert "Fix idb"" (#7860)

This reverts commit 67875e2afa.
This commit is contained in:
tamaina 2021-10-08 13:37:55 +09:00 committed by GitHub
parent b875cc9949
commit 597c9761cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,6 @@ import {
get as iget,
set as iset,
del as idel,
createStore,
} from 'idb-keyval';
const fallbackName = (key: string) => `idbfallback::${key}`;
@ -13,9 +12,9 @@ let idbAvailable = typeof window !== 'undefined' ? !!window.indexedDB : true;
if (idbAvailable) {
try {
await createStore('keyval-store', 'keyval');
await iset('idb-test', 'test');
} catch (e) {
console.error('idb open error', e);
console.error('idb error', e);
idbAvailable = false;
}
}