何らかの理由によりクライアントの絵文字キャッシュが削除された場合ただちに再取得するように修正 (MisskeyIO#163)
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
get as iget,
|
||||
set as iset,
|
||||
del as idel,
|
||||
keys as ikeys,
|
||||
} from 'idb-keyval';
|
||||
|
||||
const fallbackName = (key: string) => `idbfallback::${key}`;
|
||||
@@ -40,3 +41,11 @@ export async function del(key: string) {
|
||||
if (idbAvailable) return idel(key);
|
||||
return window.localStorage.removeItem(fallbackName(key));
|
||||
}
|
||||
|
||||
export async function exist(key: string) {
|
||||
if (idbAvailable) {
|
||||
const keys = await ikeys();
|
||||
return keys.includes(key);
|
||||
}
|
||||
return window.localStorage.getItem(fallbackName(key)) !== null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user