Merge branch 'migrate-accounts-to-idb' into sw-notification-action
This commit is contained in:
commit
ea41ab3bba
1 changed files with 1 additions and 6 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue