doc/viewer_src/parser.worker.ts
raw| 1 | import {parseReconstruction, reconstructionTransferables} from "./parser"; |
| 2 | |
| 3 | self.onmessage = async (event: MessageEvent<Map<string, File>>) => { |
| 4 | try { |
| 5 | const reconstruction = await parseReconstruction(event.data); |
| 6 | self.postMessage({ok: true, reconstruction}, {transfer: reconstructionTransferables(reconstruction)}); |
| 7 | } catch (error) { |
| 8 | self.postMessage({ok: false, error: error instanceof Error ? error.message : String(error)}); |
| 9 | } |
| 10 | }; |