简体   繁体   English

网络工作者中的微秒或至少亚毫秒计时?

[英]Microsecond or at least sub-millisecond timing in a web-worker?

There are libraries for high precision timers in node.js and there is the window.performance.now() for the main thread https://stackoverflow.com/a/21120901/1056563 . node.js有高精度计时器库,主线程有window.performance.now() https://stackoverflow.com/a/21120901/1056563 Is there anything for web-workers (which do not have access to window or the DOM )?网络工作者(无权访问windowDOM )有什么东西吗?

There's a performance property on WorkerGlobalScope . WorkerGlobalScope上有一个performance属性。 It's not super-widely supported, but then again neither are web workers.它没有得到超级广泛的支持,但同样也不是网络工作者。

Specifically, .now() is (apparently) available to web workers, if that's all you need.具体来说, .now() (显然)可供网络工作者使用,如果这就是您所需要的。

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

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