mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-25 11:56:36 +00:00
19 lines
507 B
TypeScript
19 lines
507 B
TypeScript
import { importEmojiData, importCustomEmojiData } from './loader';
|
|
|
|
addEventListener('message', handleMessage);
|
|
self.postMessage('ready'); // After the worker is ready, notify the main thread
|
|
|
|
function handleMessage(event: MessageEvent<string>) {
|
|
const { data: locale } = event;
|
|
void loadData(locale);
|
|
}
|
|
|
|
async function loadData(locale: string) {
|
|
if (locale !== 'custom') {
|
|
await importEmojiData(locale);
|
|
} else {
|
|
await importCustomEmojiData();
|
|
}
|
|
self.postMessage(`loaded ${locale}`);
|
|
}
|