gpt4 book ai didi

javascript - Web Worker 里面的 Web Worker 可能吗?

转载 作者:行者123 更新时间:2023-12-04 21:35:22 25 4
gpt4 key购买 nike

我试图在网络 worker 中产生一个网络 worker ,但我得到了这个错误:

mainWorker.js:92 Uncaught ReferenceError: Worker is not defined



使用此代码:
var worker = new Worker('subWorker.js');
worker.postMessage(......);

这在某种程度上可能吗?

最佳答案

对于在这里绊倒的任何人,嵌套 worker 现在至少在 Chrome 中有一些支持:https://www.chromestatus.com/feature/6080438103703552 :

Dedicated workers can create nested workers, but shared workers and service workers cannot.

Creating a nested dedicated worker from a shared worker is not yet supported.

Nested shared workers are also in the spec, but there is no plan to support them at this time.

关于javascript - Web Worker 里面的 Web Worker 可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39665582/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com