Merge branch 'migrate-accounts-to-idb' into sw-notification-action

This commit is contained in:
tamaina 2021-07-27 01:49:49 +09:00
commit ea41ab3bba
1 changed files with 1 additions and 6 deletions

View File

@ -4,16 +4,12 @@ import {
get as iget,
set as iset,
del as idel,
createStore
} from 'idb-keyval';
const fallbackName = (key: string) => `idbfallback::${key}`;
let idbAvailable = typeof window !== 'undefined' ? !!window.indexedDB : true;
console.log(window.indexedDB);
console.log(idbAvailable);
if (idbAvailable) {
try {
const request = indexedDB.open('keyval-store');
@ -23,12 +19,11 @@ if (idbAvailable) {
request.onsuccess = (e) => res(e);
});
} catch (e) {
console.log('catch', e)
console.error('idb open error', e);
idbAvailable = false;
}
}
console.log(idbAvailable);
if (!idbAvailable) console.error('indexedDB is unavailable. It will use localStorage.');
export async function get(key: string) {