Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

601 B
Raw Blame
// netlistsvg in a worker thread: ELK's layout is synchronous and can take seconds on a big module,
// and the server must keep answering the page (and its event stream) meanwhile.
import { parentPort } from 'node:worker_threads'
import { createRequire } from 'node:module'

const require = createRequire(import.meta.url)

parentPort.on('message', async ({ id, skin, netlist }) => {
  try {
    const lib = require('netlistsvg')
    const svg = await lib.render(skin, netlist)
    parentPort.postMessage({ id, svg })
  } catch (error) {
    parentPort.postMessage({ id, error: error.message })
  }
})