[英]requestAnimationFrame is not defined in web-worker in Firefox?
我找不到任何信息,为什么 Firefox v91.10.0esr on Windows 10 抱怨未定义requestAnimationFrame
:
const worker = new Worker( URL.createObjectURL( new Blob( ["requestAnimationFrame(() => this.postMessage('requestAnimationFrame in web-worker process'))"], { type: "text/javascript" }))); worker.addEventListener("message", e => { console.log(e.data); }); requestAnimationFrame(() => console.log("requestAnimationFrame in main process"));
19:09:53.100 ReferenceError: requestAnimationFrame is not defined 569ddce0-b6c3-47c9-88b4-89d59445b335:1:1
<anonymous> blob:null/569ddce0-b6c3-47c9-88b4-89d59445b335:1
它在 Android Firefox 和其他浏览器(Edge、Chrome)上运行良好。
有任何想法吗?
Firefox 在使用 v97 的 worker 中添加了对 requestAnimationFrame 和 cancelAnimationFrame 的支持,如您在此问题上所见。 评论 17 和 18只是证实了这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.