GitShow/developit/web-worker
developit

web-worker

Consistent Web Workers in browser and Node.

by developit
Star on GitHubForkWebsitenpm

JavaScript

1.2k stars58 forks13 contributorsQuiet · 1y agoSince 20191.5.0Apache-2.0

Meet the team

See all 13 on GitHub →
developit
developit63 contributions
martines3000
martines300018 contributions
guybedford
guybedford4 contributions
eshaz
eshaz2 contributions
Jarred-Sumner
Jarred-Sumner2 contributions
mmomtchev
mmomtchev2 contributions
pubkey
pubkey2 contributions
phated
phated1 contribution

Languages

View on GitHub →
JavaScript98.9%
TypeScript1.1%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

3 of 6 standards met

Community profile →
57
✓README✓License✓Contributing○Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Quiet · 6 in progress · Last activity 1y ago
See all on GitHub →
DerZade
can't import web-worker inside a NodeJS worker thread with no workerDataOpenIssue

Simply having an import to inside a NodeJS worker thread with no will result in the following error: Reproduction Notes I saw that #40 tried to fix this issue already, but didn't fix it completely. The fix assumes is set to a value. If it is , we still run into the same issue as described in #40: [...] When using this library within a worker thread, the code is executed, rather than the code which creates the worker polyfill. [...] This change executes only if the property is present from the , indicating that it's being executed from a thread created within this library. If isn't present, this means that the code is executing within the context of some other worker thread that wasn't created from this library, and it needs to treat the current thread as the main thread by executing .

DerZade · 2mo ago
DerZade
fix: allow importing inside a NodeJS worker with no workerDataOpenPR

This PR fixes #57 I added a to the destructuring to ensure we have a valid value to destructure. In addition to that I added a new attribute with a unique name (includes a UUID, so it's basically impossible to set this by accident) to the . This ensures we can reliably verify that we are running in a worker thread, which was created by . All other threads will use the code path (and not the code path). Something similar was already suggested by eshaz in #40: [...] One enhancement might be to randomize the property name. This change assumes that a parent thread won't send a property in the ...

DerZade · 2mo ago
gerdstolpmann
worker starting further workersOpenIssue

I recently ran into a bad trap: I had another in the code of the child and not only in the parent. This doesn't work, because the function is then executed again. The symptom is that messages are received twice in the worker. This was hard to figure out. Note that this is not really a user's error, because a web worker is normally allowed to start another web worker. So it makes sense in general. (In my code, I could simply comment the bad out, though.) I guess that you need to split into two files for this, because the main/worker dichotomy doesn't work anymore when workers can start workers.

gerdstolpmann · 6mo ago

Recent fixes

View closed PRs →
ecofi
How to stop a worker?ClosedIssue

[Please ignore]

ecofi · 1y ago
wildeyes
Warning: "Critical dependency: the request of a dependency is an expression"ClosedIssue

Using latest nextjs, I'm getting Seems related to #6 looks similiar to https://github.com/iamakulov/moment-locales-webpack-plugin/issues/43 I'm not yet knowledgable enough about ESM modules and their handling, but will hop by to report if I manage to solve this. Cheerio

wildeyes · 1y ago
Structured data for AI agents

Repository: developit/web-worker. Description: Consistent Web Workers in browser and Node. Stars: 1174, Forks: 58. Primary language: JavaScript. Languages: JavaScript (98.9%), TypeScript (1.1%). License: Apache-2.0. Homepage: https://npm.im/web-worker Latest release: 1.5.0 (1y ago). Open PRs: 6, open issues: 11. Last activity: 1y ago. Community health: 57%. Top contributors: developit, martines3000, guybedford, eshaz, Jarred-Sumner, mmomtchev, pubkey, phated, metcoder95, danielroe and others.

·@ofershap

Replace github.com with gitshow.dev