简体   繁体   English

WebOS中的细粒度定时

[英]Fine-Grain Timing in WebOS

I'm looking to build a program that works within soft real-time schedules; 我正在寻找一个可以在软实时时间表内运行的程序; to do this, I need to generate a timing event at an interval significantly less than a second. 为此,我需要以明显小于一秒的时间间隔生成一个计时事件。

Is there an API that exposes fine-grain timers in WebOS? WebOS中是否存在公开细粒度计时器的API?

You can use the DOM API setTimeout() to have a function be called back in the future. 您可以使用DOM API setTimeout()在将来调用一个函数。 The timing is specified in milliseconds. 计时以毫秒为单位。 Your callback will be called at least that many milliseconds after the call to setTimeout, but it could be longer if other JS code is running, since the Javascript engine won't interrupt running code to call your function. 在调用setTimeout之后至少要数毫秒才能调用您的回调,但是如果正在运行其他JS代码,则回调时间可能会更长,因为Javascript引擎不会中断正在运行的代码来调用您的函数。

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

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