also use emojiType as cache key for dynamic asset cache

This commit is contained in:
m5r
2023-02-16 09:23:45 +01:00
parent 16139c3bcc
commit 83ee9f7e4b
2 changed files with 3 additions and 6 deletions

View File

@@ -37,12 +37,9 @@ const apis = {
"https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/" + code.toLowerCase() + "_flat.svg",
};
export type EmojiType = keyof typeof apis;
export function loadEmoji(code: string, type?: EmojiType) {
export function loadEmoji(code: string, type: EmojiType) {
// https://github.com/svgmoji/svgmoji
if (!type || !apis[type]) {
type = "twemoji";
}
const api = apis[type];
const api = apis[type] ?? apis.twemoji;
if (typeof api === "function") {
return fetch(api(code));
}