Web Worker 本身是否允许拥有 Web Worker 线程?
在 Firefox 3.5+ 中似乎就是这种情况,我可以实例化一个 Web Worker,并在该 Worker 内部生成另一个线程。然而,该代码无法在 Google Chrome 中运行,这让我相信这要么是 Mozilla 对该规范的专有扩展,要么是 Chrome 尚未完全实现该规范。那么是哪一个呢?
This would seem to be the case in Firefox 3.5+, there I can instantiate a Web Worker, and inside the worker, spawn another thread. However, the code will not work in Google Chrome, leading me to believe this is either a Mozilla proprietary extension to the spec or that Chrome has not fully implemented the spec. So which is it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://www.whatwg.org /specs/web-workers/current-work/#interface-objects-and-constructors 似乎说它可能是可能的(截至2009年10月21日):
“一定没有接口对象和构造函数在脚本的全局范围内可用,其脚本的全局对象是 WorkerGlobalScope 对象,但以下对象除外:[...] Worker 和 SharedWorker 接口对象和构造函数。”
这里
您可能想搜索未解决的问题/发布反馈。该规范有这样的文字:
http://www.whatwg.org/specs/web-workers/current-work/#interface-objects-and-constructors seems to say it MAY be possible (as of 21.10.2009):
"There must be no interface objects and constructors available in the global scope of scripts whose script's global object is a WorkerGlobalScope object except for the following: [...] The Worker and SharedWorker interface objects and constructors."
Here
You might want to search open issues/post feedback. The spec has this text:
是的,网络工作人员可以生成子工作人员。主要的最新浏览器都支持 webworker 界面。
这里有一些教程来获取它。
https://developer.mozilla.org/en-US/docs/DOM/Using_web_workers
https://developer.mozilla.org/en-US /docs/DOM/Worker/Functions_available_to_workers
Yes, webworkers can spawn subworkers. major latest browsers are supporting webworker interface.
Here are some tutorials to get it.
https://developer.mozilla.org/en-US/docs/DOM/Using_web_workers
https://developer.mozilla.org/en-US/docs/DOM/Worker/Functions_available_to_workers