Open danielepolencic opened 7 years ago
Makes sense, pull reqs welcome at src/worker.ls
.
Given the current code base, would new Worker(eval(string))
work too?
This is exactly what I need... I want to construct workers from strings that are dynamically created at run-time.
It would be nice to have this natively supported so that it is consistent with the browser behavior (blob url)
I had a quick look at the source code and it's not possible to use a string to create a WebWorker:
The reason why this is interesting is because you could use browserify to compile typescript/livescript files and inline them in the webworker (with all the imports and requires resolved).
The browser API has a similar functionality:
I had a quick look at the code and it should be feasible to detect if the input is a Buffer and load the content as a web worker.
Any thoughts?