@@ -49,25 +49,26 @@ milliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the
49
49
50
50
## setTimeout(callback, delay[ , arg] [ , ... ] )
51
51
52
- To schedule execution of a one-time ` callback ` after ` delay ` milliseconds. Returns a
53
- ` timeoutObject ` for possible use with ` clearTimeout() ` . Optionally you can
54
- also pass arguments to the callback.
52
+ To schedule execution of a one-time ` callback ` after ` delay ` milliseconds.
53
+ Returns a ` timeoutObject ` for possible use with ` clearTimeout() ` . Optionally you
54
+ can also pass arguments to the callback.
55
55
56
- It is important to note that your callback will probably not be called in exactly
57
- ` delay ` milliseconds - Node.js makes no guarantees about the exact timing of when
58
- the callback will fire, nor of the ordering things will fire in. The callback will
59
- be called as close as possible to the time specified.
56
+ The callback will likely not be invoked in precisely ` delay ` milliseconds.
57
+ Node.js makes no guarantees about the exact timing of when callbacks will fire,
58
+ nor of their ordering. The callback will be called as close as possible to the
59
+ time specified.
60
60
61
61
To follow browser behavior, when using delays larger than 2147483647
62
62
milliseconds (approximately 25 days) or less than 1, the timeout is executed
63
63
immediately, as if the ` delay ` was set to 1.
64
64
65
65
## unref()
66
66
67
- The opaque value returned by [ ` setTimeout ` ] [ ] and [ ` setInterval ` ] [ ] also has the method
68
- ` timer.unref() ` which will allow you to create a timer that is active but if
69
- it is the only item left in the event loop, it won't keep the program running.
70
- If the timer is already ` unref ` d calling ` unref ` again will have no effect.
67
+ The opaque value returned by [ ` setTimeout ` ] [ ] and [ ` setInterval ` ] [ ] also has the
68
+ method ` timer.unref() ` which will allow you to create a timer that is active but
69
+ if it is the only item left in the event loop, it won't keep the program
70
+ running. If the timer is already ` unref ` d calling ` unref ` again will have no
71
+ effect.
71
72
72
73
In the case of ` setTimeout ` when you ` unref ` you create a separate timer that
73
74
will wakeup the event loop, creating too many of these may adversely effect
0 commit comments