summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/idb-proxy.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-07-13 21:59:47 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-07-13 21:59:47 +0900
commitbce48dfee933d9feb3be381ad22ea765dd6a3aab (patch)
treeb21a3a765040469885d286487245aeaed373bba6 /packages/client/src/scripts/idb-proxy.ts
parentMerge branch 'develop' (diff)
parent12.113.0 (diff)
downloadmisskey-bce48dfee933d9feb3be381ad22ea765dd6a3aab.tar.gz
misskey-bce48dfee933d9feb3be381ad22ea765dd6a3aab.tar.bz2
misskey-bce48dfee933d9feb3be381ad22ea765dd6a3aab.zip
Merge branch 'develop'
Diffstat (limited to 'packages/client/src/scripts/idb-proxy.ts')
-rw-r--r--packages/client/src/scripts/idb-proxy.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/client/src/scripts/idb-proxy.ts b/packages/client/src/scripts/idb-proxy.ts
index d462a0d7ce..77bb84463c 100644
--- a/packages/client/src/scripts/idb-proxy.ts
+++ b/packages/client/src/scripts/idb-proxy.ts
@@ -11,16 +11,15 @@ const fallbackName = (key: string) => `idbfallback::${key}`;
let idbAvailable = typeof window !== 'undefined' ? !!window.indexedDB : true;
if (idbAvailable) {
- try {
- await iset('idb-test', 'test');
- } catch (err) {
+ 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.');
}
-if (!idbAvailable) console.error('indexedDB is unavailable. It will use localStorage.');
-
export async function get(key: string) {
if (idbAvailable) return iget(key);
return JSON.parse(localStorage.getItem(fallbackName(key)));