取消定时器


setImmediate()setInterval()setTimeout() 方法各自返回表示调度的定时器的对象。 这些可用于取消定时器并防止其触发。

The setImmediate(), setInterval(), and setTimeout() methods each return objects that represent the scheduled timers. These can be used to cancel the timer and prevent it from triggering.

It is not possible to cancel timers that were created using the promisified variants of setImmediate(), setTimeout().