| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,10 +127,16 @@ function enroll(item, msecs) { | |||
| 127 | 127 | } | |
| 128 | 128 | ||
| 129 | 129 | ||
| 130 | - /* | ||
| 131 | - * DOM-style timers | ||
| 130 | + /** | ||
| 131 | + * Schedules the execution of a one-time `callback` | ||
| 132 | + * after `after` milliseconds. | ||
| 133 | + * @param {Function} callback | ||
| 134 | + * @param {number} [after] | ||
| 135 | + * @param {any} [arg1] | ||
| 136 | + * @param {any} [arg2] | ||
| 137 | + * @param {any} [arg3] | ||
| 138 | + * @returns {Timeout} | ||
| 132 | 139 | */ | |
| 133 | - | ||
| 134 | 140 | function setTimeout(callback, after, arg1, arg2, arg3) { | |
| 135 | 141 | validateCallback(callback); | |
| 136 | 142 | ||
@@ -170,6 +176,11 @@ ObjectDefineProperty(setTimeout, customPromisify, { | |||
| 170 | 176 | } | |
| 171 | 177 | }); | |
| 172 | 178 | ||
| 179 | + /** | ||
| 180 | + * Cancels a timeout. | ||
| 181 | + * @param {Timeout | string | number} timer | ||
| 182 | + * @returns {void} | ||
| 183 | + */ | ||
| 173 | 184 | function clearTimeout(timer) { | |
| 174 | 185 | if (timer && timer._onTimeout) { | |
| 175 | 186 | timer._onTimeout = null; | |
@@ -185,6 +196,16 @@ function clearTimeout(timer) { | |||
| 185 | 196 | } | |
| 186 | 197 | } | |
| 187 | 198 | ||
| 199 | + /** | ||
| 200 | + * Schedules repeated execution of `callback` | ||
| 201 | + * every `repeat` milliseconds. | ||
| 202 | + * @param {Function} callback | ||
| 203 | + * @param {number} [repeat] | ||
| 204 | + * @param {any} [arg1] | ||
| 205 | + * @param {any} [arg2] | ||
| 206 | + * @param {any} [arg3] | ||
| 207 | + * @returns {Timeout} | ||
| 208 | + */ | ||
| 188 | 209 | function setInterval(callback, repeat, arg1, arg2, arg3) { | |
| 189 | 210 | validateCallback(callback); | |
| 190 | 211 | ||
@@ -215,6 +236,11 @@ function setInterval(callback, repeat, arg1, arg2, arg3) { | |||
| 215 | 236 | return timeout; | |
| 216 | 237 | } | |
| 217 | 238 | ||
| 239 | + /** | ||
| 240 | + * Cancels an interval. | ||
| 241 | + * @param {Timeout | string | number} timer | ||
| 242 | + * @returns {void} | ||
| 243 | + */ | ||
| 218 | 244 | function clearInterval(timer) { | |
| 219 | 245 | // clearTimeout and clearInterval can be used to clear timers created from | |
| 220 | 246 | // both setTimeout and setInterval, as specified by HTML Living Standard: | |
@@ -227,6 +253,10 @@ Timeout.prototype.close = function() { | |||
| 227 | 253 | return this; | |
| 228 | 254 | }; | |
| 229 | 255 | ||
| 256 | + /** | ||
| 257 | + * Coerces a `Timeout` to a primitive. | ||
| 258 | + * @returns {number} | ||
| 259 | + */ | ||
| 230 | 260 | Timeout.prototype[SymbolToPrimitive] = function() { | |
| 231 | 261 | const id = this[async_id_symbol]; | |
| 232 | 262 | if (!this[kHasPrimitive]) { | |
@@ -236,6 +266,15 @@ Timeout.prototype[SymbolToPrimitive] = function() { | |||
| 236 | 266 | return id; | |
| 237 | 267 | }; | |
| 238 | 268 | ||
| 269 | + /** | ||
| 270 | + * Schedules the immediate execution of `callback` | ||
| 271 | + * after I/O events' callbacks. | ||
| 272 | + * @param {Function} callback | ||
| 273 | + * @param {any} [arg1] | ||
| 274 | + * @param {any} [arg2] | ||
| 275 | + * @param {any} [arg3] | ||
| 276 | + * @returns {Immediate} | ||
| 277 | + */ | ||
| 239 | 278 | function setImmediate(callback, arg1, arg2, arg3) { | |
| 240 | 279 | validateCallback(callback); | |
| 241 | 280 | ||
@@ -271,7 +310,11 @@ ObjectDefineProperty(setImmediate, customPromisify, { | |||
| 271 | 310 | } | |
| 272 | 311 | }); | |
| 273 | 312 | ||
| 274 | - | ||
| 313 | + /** | ||
| 314 | + * Cancels an immediate. | ||
| 315 | + * @param {Immediate} immediate | ||
| 316 | + * @returns {void} | ||
| 317 | + */ | ||
| 275 | 318 | function clearImmediate(immediate) { | |
| 276 | 319 | if (!immediate || immediate._destroyed) | |
| 277 | 320 | return; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments