timers 定时器


稳定性: 2 - 稳定

源代码: lib/timers.js

timer 模块暴露了一个全局的用于在未来某个时间点调用的调度函数的 API。 因为定时器函数是全局的,所以不需要调用 require('timers') 来使用该 API。

Node.js 中的定时器函数实现了与网络浏览器提供的定时器 API 类似的 API,但使用的是围绕 Node.js 事件循环构建的不同的内部实现。

Stability: 2 - Stable

Source Code: lib/timers.js

The timer module exposes a global API for scheduling functions to be called at some future period of time. Because the timer functions are globals, there is no need to call require('timers') to use the API.

The timer functions within Node.js implement a similar API as the timers API provided by Web Browsers but use a different internal implementation that is built around the Node.js Event Loop.