developit / developit/web-worker

worker starting further workers

未关闭
#12 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
1.2k
派生
57
PR 合并指标
30 天内没有已合并 PR

描述

I recently ran into a bad trap: I had another `require('web-worker')` in the code of the child and not only in the parent. This doesn't work, because the `workerThread` 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 `require` out, though.)

I guess that you need to split `node.js` into two files for this, because the main/worker dichotomy doesn't work anymore when workers can start workers.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。