简体   繁体   English

requestAnimationFrame 没有在 Firefox 的 web-worker 中定义?

[英]requestAnimationFrame is not defined in web-worker in Firefox?

I can't find any information why Firefox v91.10.0esr on Windows 10 complains that requestAnimationFrame is not defined:我找不到任何信息,为什么 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

It works fine on Android Firefox and other browsers (Edge, Chrome).它在 Android Firefox 和其他浏览器(Edge、Chrome)上运行良好。

Any ideas?有任何想法吗?

Firefox added support for requestAnimationFrame and cancelAnimationFrame in workers with v97 as you can see on this issue . Firefox 在使用 v97 的 worker 中添加了对 requestAnimationFrame 和 cancelAnimationFrame 的支持,如您在此问题上所见。 Comment 17 and 18 just confirm it.评论 17 和 18只是证实了这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM