javascript - Three.js Web Worker 兼容吗? importScripts ("three.js")给出错误

标签 javascript html three.js compatibility web-worker

它提示 importScripts("third.js"):

 Uncaught ReferenceError: window is not defined:
 for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++ x ) {

删除 Three.js 中引用 window 对象的所有内容似乎很麻烦,还是没有其他方法?

我需要在多个核心上渲染期间创建大量几何体+对象,并且我不希望主线程在执行此操作时卡住。

最佳答案

如果您在网络工作人员中使用此代码,您必须记住网络工作人员无权访问窗口对象。

查找更多信息here .

关于javascript - Three.js Web Worker 兼容吗? importScripts ("three.js")给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16728042/

相关文章:

javascript - Three.js 线垂直于球体

php - 如何反序列化字符串?

html - 我怎样才能使 Bootstrap 缩略图的高度相同?

html - IE 中丢失的样式

javascript - 如何在 Three.js 中将相机自动聚焦在一个点上?

javascript - three.js - 如何限制缩放以使对象不会因相机而损坏

javascript - websql成功回调在查询后无法访问变量

javascript - html5 拖放 - items.webkitGetAsEntry() 方法不存在

javascript - 如何获取元素更改的排序列表的索引?

html - 使用 Bootstrap 使用单选按钮进行选项卡控制