feat(node): worker_threads#1151
Conversation
|
CI errors are related to denoland/deno#9696. |
bartlomieju
left a comment
There was a problem hiding this comment.
This looks good @Mesteery, but please some more tests that actually execute some code in workers.
|
Yes of course, the more complete tests are already added locally. |
e6cb287 to
0612616
Compare
Mesteery
left a comment
There was a problem hiding this comment.
This is almost ready except for...
| @@ -0,0 +1,217 @@ | |||
| /// <reference lib="webworker"/> | |||
There was a problem hiding this comment.
The tests fail systematically because of the typing errors involved in this reference, so the solution to make it work is --no-check. Do you know another way?
There was a problem hiding this comment.
Does /// <reference lib="deno.worker" /> fix it?
There was a problem hiding this comment.
0612616 to
299b473
Compare
|
Ooops, looks like I borked the merge. |
|
no worries, it's fixed |
|
@Mesteery I discussed this offline with @kitsonk. We believe the way forward right now is to use
Would be happy to land it for tomorrow's release if you manage to fix those errors. |
It's an exposed interface too: https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope |
Ooops, silly me, I checked it in Chrome's console without spawning a worker 🤦♂️ |
|
I've amended the files so they type check now. Side note, I know we went for |
|
|
||
| emitter.once(name, eventListener); | ||
| return; | ||
| emitter.once("error", errorListener); |
There was a problem hiding this comment.
This line is now failing "Can add once event listener to EventTarget via standalone function" test
There was a problem hiding this comment.
Okay, i will fix this.
|
It's a shame this one got derailed, the PR seemed to be very close! |
|
@guybedford this PR is more or less complete, however there's still problem with TS types. I wonder if we should maybe skip typings completely for the time being and just land it. |
6deed69 to
0ba2ab4
Compare
|
I think I managed to fix type errors. PTAL @bartlomieju @kitsonk |
|
This is a blocker for |
Sorry but I am not familiar with Deno. What do you mean by that? |
This is something I will work on, currently worker API doesn't respect "compat" mode and doesn't add required globals. |
|
After a lot back and forth I found the root problem of the implementation of this PR. Currently tests fails with "Module execution is still pending but there are no pending ops..." suggesting that there's a promise that never resolves. I found that this is caused by Alternatively we would have apply a lot of code from |
No description provided.