/usr/share/doc/nodejs/api/timers.html is in nodejs 0.10.25~dfsg2-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Timers Node.js v0.10.25 Manual & Documentation</title>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="http://nodejs.org/api/timers.html">
</head>
<body class="alt apidoc" id="api-section-timers">
<div id="intro" class="interior">
<a href="/" title="Go back to the home page">
<img id="logo" src="http://nodejs.org/images/logo-light.png" alt="node.js">
</a>
</div>
<div id="content" class="clearfix">
<div id="column2" class="interior">
<ul>
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs current">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
<li><a href="/logos/" class="logos">Logos</a></li>
<li><a href="http://jobs.nodejs.org/" class="jobs">Jobs</a></li>
</ul>
<p class="twitter"><a href="http://twitter.com/nodejs">@nodejs</a></p>
</div>
<div id="column1" class="interior">
<header>
<h1>Node.js v0.10.25 Manual & Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
<a href="all.html">View on single page</a> |
<a href="timers.json">View as JSON</a>
</p>
</div>
<hr>
</header>
<div id="toc">
<h2>Table of Contents</h2>
<ul>
<li><a href="#timers_timers">Timers</a><ul>
<li><a href="#timers_settimeout_callback_delay_arg">setTimeout(callback, delay, [arg], [...])</a></li>
<li><a href="#timers_cleartimeout_timeoutid">clearTimeout(timeoutId)</a></li>
<li><a href="#timers_setinterval_callback_delay_arg">setInterval(callback, delay, [arg], [...])</a></li>
<li><a href="#timers_clearinterval_intervalid">clearInterval(intervalId)</a></li>
<li><a href="#timers_unref">unref()</a></li>
<li><a href="#timers_ref">ref()</a></li>
<li><a href="#timers_setimmediate_callback_arg">setImmediate(callback, [arg], [...])</a></li>
<li><a href="#timers_clearimmediate_immediateid">clearImmediate(immediateId)</a></li>
</ul>
</li>
</ul>
</div>
<div id="apicontent">
<h1>Timers<span><a class="mark" href="#timers_timers" id="timers_timers">#</a></span></h1>
<pre class="api_stability_5">Stability: 5 - Locked</pre><p>All of the timer functions are globals. You do not need to <code>require()</code>
this module in order to use them.
</p>
<h2>setTimeout(callback, delay, [arg], [...])<span><a class="mark" href="#timers_settimeout_callback_delay_arg" id="timers_settimeout_callback_delay_arg">#</a></span></h2>
<p>To schedule execution of a one-time <code>callback</code> after <code>delay</code> milliseconds. Returns a
<code>timeoutId</code> for possible use with <code>clearTimeout()</code>. Optionally you can
also pass arguments to the callback.
</p>
<p>It is important to note that your callback will probably not be called in exactly
<code>delay</code> milliseconds - Node.js makes no guarantees about the exact timing of when
the callback will fire, nor of the ordering things will fire in. The callback will
be called as close as possible to the time specified.
</p>
<h2>clearTimeout(timeoutId)<span><a class="mark" href="#timers_cleartimeout_timeoutid" id="timers_cleartimeout_timeoutid">#</a></span></h2>
<p>Prevents a timeout from triggering.
</p>
<h2>setInterval(callback, delay, [arg], [...])<span><a class="mark" href="#timers_setinterval_callback_delay_arg" id="timers_setinterval_callback_delay_arg">#</a></span></h2>
<p>To schedule the repeated execution of <code>callback</code> every <code>delay</code> milliseconds.
Returns a <code>intervalId</code> for possible use with <code>clearInterval()</code>. Optionally
you can also pass arguments to the callback.
</p>
<h2>clearInterval(intervalId)<span><a class="mark" href="#timers_clearinterval_intervalid" id="timers_clearinterval_intervalid">#</a></span></h2>
<p>Stops a interval from triggering.
</p>
<h2>unref()<span><a class="mark" href="#timers_unref" id="timers_unref">#</a></span></h2>
<p>The opaque value returned by <code>setTimeout</code> and <code>setInterval</code> also has the method
<code>timer.unref()</code> which will allow you to create a timer that is active but if
it is the only item left in the event loop won't keep the program running.
If the timer is already <code>unref</code>d calling <code>unref</code> again will have no effect.
</p>
<p>In the case of <code>setTimeout</code> when you <code>unref</code> you create a separate timer that
will wakeup the event loop, creating too many of these may adversely effect
event loop performance -- use wisely.
</p>
<h2>ref()<span><a class="mark" href="#timers_ref" id="timers_ref">#</a></span></h2>
<p>If you had previously <code>unref()</code>d a timer you can call <code>ref()</code> to explicitly
request the timer hold the program open. If the timer is already <code>ref</code>d calling
<code>ref</code> again will have no effect.
</p>
<h2>setImmediate(callback, [arg], [...])<span><a class="mark" href="#timers_setimmediate_callback_arg" id="timers_setimmediate_callback_arg">#</a></span></h2>
<p>To schedule the "immediate" execution of <code>callback</code> after I/O events
callbacks and before <code>setTimeout</code> and <code>setInterval</code> . Returns an
<code>immediateId</code> for possible use with <code>clearImmediate()</code>. Optionally you
can also pass arguments to the callback.
</p>
<p>Immediates are queued in the order created, and are popped off the queue once
per loop iteration. This is different from <code>process.nextTick</code> which will
execute <code>process.maxTickDepth</code> queued callbacks per iteration. <code>setImmediate</code>
will yield to the event loop after firing a queued callback to make sure I/O is
not being starved. While order is preserved for execution, other I/O events may
fire between any two scheduled immediate callbacks.
</p>
<h2>clearImmediate(immediateId)<span><a class="mark" href="#timers_clearimmediate_immediateid" id="timers_clearimmediate_immediateid">#</a></span></h2>
<p>Stops an immediate from triggering.
</p>
</div>
</div>
</div>
<div id="footer">
<a href="http://joyent.com" class="joyent-logo">Joyent</a>
<ul class="clearfix">
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
<li><a href="/logos/">Logos</a></li>
<li><a href="http://jobs.nodejs.org/">Jobs</a></li>
<li><a href="http://twitter.com/nodejs" class="twitter">@nodejs</a></li>
</ul>
<p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.25/LICENSE">license</a>.</p>
</div>
</body>
</html>
|