2023-08-15 02:52:38 +09:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-05-19 09:44:06 +09:00
|
|
|
import { render } from 'buraha';
|
|
|
|
|
2023-07-02 13:46:49 +09:00
|
|
|
const canvas = new OffscreenCanvas(64, 64);
|
|
|
|
|
2023-05-19 09:44:06 +09:00
|
|
|
onmessage = (event) => {
|
2023-08-15 02:52:38 +09:00
|
|
|
// console.log(event.data);
|
|
|
|
if (!('id' in event.data && typeof event.data.id === 'string')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!('hash' in event.data && typeof event.data.hash === 'string')) {
|
|
|
|
return;
|
|
|
|
}
|
2023-07-02 13:46:49 +09:00
|
|
|
|
2023-08-15 02:52:38 +09:00
|
|
|
render(event.data.hash, canvas);
|
|
|
|
const bitmap = canvas.transferToImageBitmap();
|
|
|
|
postMessage({ id: event.data.id, bitmap });
|
2023-05-19 09:44:06 +09:00
|
|
|
};
|