Grokking Node.js
Vote

0% completed

​

Working with Timers

The number you pass to setTimeout is the shortest time Node.js will wait, not an exact time. In our tests, a timer set for 2,000 milliseconds fired after 2,005 ms, and a timer set for 1,000 ms that was waiting behind three seconds of busy code fired after 3001 ms. A timer callback is placed in the timers queue when its time has passed, and it still waits for the event loop to reach that queue.

Node.js gives you three functions for scheduling code: setTimeout runs a function once after a delay, setInterval runs it again and again, and `setImmediate

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content