@mbartoldus/stringworker@0.1.1
latest
makes a worker from a given script string
This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun




JSR Score
100%
Published
a year ago (0.1.1)
/** * Takes a script represented as a string, and returns a worker running that script. */ export function stringWorker(script: string): Worker { const blob = new Blob([script], { type: 'text/javascript' }) const url = URL.createObjectURL(blob) const worker = new Worker(url, { type: 'module' }) URL.revokeObjectURL(url) return worker }