Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
import { EcadParserService } from '../core/ecad/EcadParserService.mjs'
globalThis.addEventListener('message', async (event) => {
const payload = event?.data || {}
if (payload.type !== 'parse:file' && payload.type !== 'parse:entries') {
return
}
try {
const result =
payload.type === 'parse:entries'
? await EcadParserService.parseEntries(payload.entries || [], {
worker: false
})
: await EcadParserService.parseEntries(
[
{
name: String(payload.fileName || 'document'),
buffer: payload.buffer
}
],
{ worker: false }
)
globalThis.postMessage({
type: 'parser:success',
requestId: String(payload.requestId || ''),
...result
})
} catch (error) {
globalThis.postMessage({
type: 'parser:error',
requestId: String(payload.requestId || ''),
message:
error instanceof Error ? error.message : 'Parser worker failed.'
})
}
})
5f635a4c0This file is pinned to the selected release. Download the original to open it in your design tool.