开发者

JavaScript timer implementation

开发者 https://www.devze.com 2022-12-19 01:56 出处:网络
I am trying to find out exactly how JavaScript timers work. In particular whether a timer function is execu开发者_如何学JAVAted immediately the timer expires or instead when the JavaScript engine is i

I am trying to find out exactly how JavaScript timers work. In particular whether a timer function is execu开发者_如何学JAVAted immediately the timer expires or instead when the JavaScript engine is in some kind of idle state.

For example if the JavaScript engine is executing a block of code and a timer goes off does the execution of the block of code get interrupted and the timer function called. Or does the JavaScript engine wait until it returns to some kind of idle state before it calls the timer function?

Thanks,

AJ


Here's a very good explanation from John Resig

how-javascript-timers-work

0

精彩评论

暂无评论...
验证码 换一张
取 消