import { IllusionCore } from '../core/illusion-core'; const ctx: Worker = self as any; const illusionCore = new IllusionCore(true); ctx.onmessage = async function(event: MessageEvent) { const { type, data, id } = event.data; try { const result = await illusionCore.do(type, data); ctx.postMessage({ type, data: result, id }); } catch(error) { ctx.postMessage({ type, error: error.message, id }); throw error; } } export default {};