import { encodeAnimation } from './wasm-webp/index.js';

self.onmessage = async (e) => {
    let { targetWidth, targetHeight, webpFrames } = e.data;
    try {
        let webpUint8 = await encodeAnimation(targetWidth, targetHeight, true, webpFrames);
        self.postMessage({ success: true, data: webpUint8 }, [webpUint8.buffer]);
    } catch (err) {
        self.postMessage({ success: false, error: err.toString() });
    }
};
