1{ 2 "type": "module", 3 "source": "doc/api/globals.md", 4 "introduced_in": "v0.10.0", 5 "globals": [ 6 { 7 "textRaw": "Class: `AbortController`", 8 "type": "global", 9 "name": "AbortController", 10 "meta": { 11 "added": [ 12 "v14.17.0" 13 ], 14 "changes": [] 15 }, 16 "stability": 1, 17 "stabilityText": "Experimental", 18 "desc": "<p>A utility class used to signal cancelation in selected <code>Promise</code>-based APIs.\nThe API is based on the Web API <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/AbortController\"><code>AbortController</code></a>.</p>\n<p>To use, launch Node.js using the <code>--experimental-abortcontroller</code> flag.</p>\n<pre><code class=\"language-js\">const ac = new AbortController();\n\nac.signal.addEventListener('abort', () => console.log('Aborted!'),\n { once: true });\n\nac.abort();\n\nconsole.log(ac.signal.aborted); // Prints True\n</code></pre>", 19 "methods": [ 20 { 21 "textRaw": "`abortController.abort()`", 22 "type": "method", 23 "name": "abort", 24 "meta": { 25 "added": [ 26 "v14.17.0" 27 ], 28 "changes": [] 29 }, 30 "signatures": [ 31 { 32 "params": [] 33 } 34 ], 35 "desc": "<p>Triggers the abort signal, causing the <code>abortController.signal</code> to emit\nthe <code>'abort'</code> event.</p>" 36 } 37 ], 38 "properties": [ 39 { 40 "textRaw": "`signal` Type: {AbortSignal}", 41 "type": "AbortSignal", 42 "name": "Type", 43 "meta": { 44 "added": [ 45 "v14.17.0" 46 ], 47 "changes": [] 48 } 49 } 50 ], 51 "classes": [ 52 { 53 "textRaw": "Class: `AbortSignal`", 54 "type": "class", 55 "name": "AbortSignal", 56 "meta": { 57 "added": [ 58 "v14.17.0" 59 ], 60 "changes": [] 61 }, 62 "desc": "<ul>\n<li>Extends: <a href=\"events.html#events_class_eventtarget\" class=\"type\"><EventTarget></a></li>\n</ul>\n<p>The <code>AbortSignal</code> is used to notify observers when the\n<code>abortController.abort()</code> method is called.</p>", 63 "classMethods": [ 64 { 65 "textRaw": "Static method: `AbortSignal.abort()`", 66 "type": "classMethod", 67 "name": "abort", 68 "meta": { 69 "added": [ 70 "v14.17.0" 71 ], 72 "changes": [] 73 }, 74 "signatures": [ 75 { 76 "return": { 77 "textRaw": "Returns: {AbortSignal}", 78 "name": "return", 79 "type": "AbortSignal" 80 }, 81 "params": [] 82 } 83 ], 84 "desc": "<p>Returns a new already aborted <code>AbortSignal</code>.</p>" 85 } 86 ], 87 "events": [ 88 { 89 "textRaw": "Event: `'abort'`", 90 "type": "event", 91 "name": "abort", 92 "meta": { 93 "added": [ 94 "v14.17.0" 95 ], 96 "changes": [] 97 }, 98 "params": [], 99 "desc": "<p>The <code>'abort'</code> event is emitted when the <code>abortController.abort()</code> method\nis called. The callback is invoked with a single object argument with a\nsingle <code>type</code> property set to <code>'abort'</code>:</p>\n<pre><code class=\"language-js\">const ac = new AbortController();\n\n// Use either the onabort property...\nac.signal.onabort = () => console.log('aborted!');\n\n// Or the EventTarget API...\nac.signal.addEventListener('abort', (event) => {\n console.log(event.type); // Prints 'abort'\n}, { once: true });\n\nac.abort();\n</code></pre>\n<p>The <code>AbortController</code> with which the <code>AbortSignal</code> is associated will only\never trigger the <code>'abort'</code> event once. We recommended that code check\nthat the <code>abortSignal.aborted</code> attribute is <code>false</code> before adding an <code>'abort'</code>\nevent listener.</p>\n<p>Any event listeners attached to the <code>AbortSignal</code> should use the\n<code>{ once: true }</code> option (or, if using the <code>EventEmitter</code> APIs to attach a\nlistener, use the <code>once()</code> method) to ensure that the event listener is\nremoved as soon as the <code>'abort'</code> event is handled. Failure to do so may\nresult in memory leaks.</p>" 100 } 101 ], 102 "properties": [ 103 { 104 "textRaw": "`aborted` Type: {boolean} True after the `AbortController` has been aborted.", 105 "type": "boolean", 106 "name": "Type", 107 "meta": { 108 "added": [ 109 "v14.17.0" 110 ], 111 "changes": [] 112 }, 113 "desc": "True after the `AbortController` has been aborted." 114 }, 115 { 116 "textRaw": "`onabort` Type: {Function}", 117 "type": "Function", 118 "name": "Type", 119 "meta": { 120 "added": [ 121 "v14.17.0" 122 ], 123 "changes": [] 124 }, 125 "desc": "<p>An optional callback function that may be set by user code to be notified\nwhen the <code>abortController.abort()</code> function has been called.</p>" 126 } 127 ] 128 } 129 ] 130 }, 131 { 132 "textRaw": "Class: `Buffer`", 133 "type": "global", 134 "name": "Buffer", 135 "meta": { 136 "added": [ 137 "v0.1.103" 138 ], 139 "changes": [] 140 }, 141 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function\" class=\"type\"><Function></a></li>\n</ul>\n<p>Used to handle binary data. See the <a href=\"buffer.html\">buffer section</a>.</p>" 142 }, 143 { 144 "textRaw": "`clearImmediate(immediateObject)`", 145 "type": "global", 146 "name": "clearImmediate", 147 "meta": { 148 "added": [ 149 "v0.9.1" 150 ], 151 "changes": [] 152 }, 153 "desc": "<p><a href=\"timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 154 }, 155 { 156 "textRaw": "`clearInterval(intervalObject)`", 157 "type": "global", 158 "name": "clearInterval", 159 "meta": { 160 "added": [ 161 "v0.0.1" 162 ], 163 "changes": [] 164 }, 165 "desc": "<p><a href=\"timers.html#timers_clearinterval_timeout\"><code>clearInterval</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 166 }, 167 { 168 "textRaw": "`clearTimeout(timeoutObject)`", 169 "type": "global", 170 "name": "clearTimeout", 171 "meta": { 172 "added": [ 173 "v0.0.1" 174 ], 175 "changes": [] 176 }, 177 "desc": "<p><a href=\"timers.html#timers_cleartimeout_timeout\"><code>clearTimeout</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 178 }, 179 { 180 "textRaw": "`console`", 181 "name": "`console`", 182 "meta": { 183 "added": [ 184 "v0.1.100" 185 ], 186 "changes": [] 187 }, 188 "type": "global", 189 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a></li>\n</ul>\n<p>Used to print to stdout and stderr. See the <a href=\"console.html\"><code>console</code></a> section.</p>" 190 }, 191 { 192 "textRaw": "`global`", 193 "name": "`global`", 194 "meta": { 195 "added": [ 196 "v0.1.27" 197 ], 198 "changes": [] 199 }, 200 "type": "global", 201 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a> The global namespace object.</li>\n</ul>\n<p>In browsers, the top-level scope is the global scope. This means that\nwithin the browser <code>var something</code> will define a new global variable. In\nNode.js this is different. The top-level scope is not the global scope;\n<code>var something</code> inside a Node.js module will be local to that module.</p>" 202 }, 203 { 204 "textRaw": "`process`", 205 "name": "`process`", 206 "meta": { 207 "added": [ 208 "v0.1.7" 209 ], 210 "changes": [] 211 }, 212 "type": "global", 213 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a></li>\n</ul>\n<p>The process object. See the <a href=\"process.html#process_process\"><code>process</code> object</a> section.</p>" 214 }, 215 { 216 "textRaw": "`queueMicrotask(callback)`", 217 "type": "global", 218 "name": "queueMicrotask", 219 "meta": { 220 "added": [ 221 "v11.0.0" 222 ], 223 "changes": [] 224 }, 225 "desc": "<ul>\n<li><code>callback</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function\" class=\"type\"><Function></a> Function to be queued.</li>\n</ul>\n<p>The <code>queueMicrotask()</code> method queues a microtask to invoke <code>callback</code>. If\n<code>callback</code> throws an exception, the <a href=\"process.html#process_process\"><code>process</code> object</a> <code>'uncaughtException'</code>\nevent will be emitted.</p>\n<p>The microtask queue is managed by V8 and may be used in a similar manner to\nthe <a href=\"process.html#process_process_nexttick_callback_args\"><code>process.nextTick()</code></a> queue, which is managed by Node.js. The\n<code>process.nextTick()</code> queue is always processed before the microtask queue\nwithin each turn of the Node.js event loop.</p>\n<pre><code class=\"language-js\">// Here, `queueMicrotask()` is used to ensure the 'load' event is always\n// emitted asynchronously, and therefore consistently. Using\n// `process.nextTick()` here would result in the 'load' event always emitting\n// before any other promise jobs.\n\nDataHandler.prototype.load = async function load(key) {\n const hit = this._cache.get(key);\n if (hit !== undefined) {\n queueMicrotask(() => {\n this.emit('load', hit);\n });\n return;\n }\n\n const data = await fetchData(key);\n this._cache.set(key, data);\n this.emit('load', data);\n};\n</code></pre>" 226 }, 227 { 228 "textRaw": "`setImmediate(callback[, ...args])`", 229 "type": "global", 230 "name": "setImmediate", 231 "meta": { 232 "added": [ 233 "v0.9.1" 234 ], 235 "changes": [] 236 }, 237 "desc": "<p><a href=\"timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 238 }, 239 { 240 "textRaw": "`setInterval(callback, delay[, ...args])`", 241 "type": "global", 242 "name": "setInterval", 243 "meta": { 244 "added": [ 245 "v0.0.1" 246 ], 247 "changes": [] 248 }, 249 "desc": "<p><a href=\"timers.html#timers_setinterval_callback_delay_args\"><code>setInterval</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 250 }, 251 { 252 "textRaw": "`setTimeout(callback, delay[, ...args])`", 253 "type": "global", 254 "name": "setTimeout", 255 "meta": { 256 "added": [ 257 "v0.0.1" 258 ], 259 "changes": [] 260 }, 261 "desc": "<p><a href=\"timers.html#timers_settimeout_callback_delay_args\"><code>setTimeout</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 262 }, 263 { 264 "textRaw": "`TextDecoder`", 265 "name": "`TextDecoder`", 266 "meta": { 267 "added": [ 268 "v11.0.0" 269 ], 270 "changes": [] 271 }, 272 "type": "global", 273 "desc": "<p>The WHATWG <code>TextDecoder</code> class. See the <a href=\"util.html#util_class_util_textdecoder\"><code>TextDecoder</code></a> section.</p>" 274 }, 275 { 276 "textRaw": "`TextEncoder`", 277 "name": "`TextEncoder`", 278 "meta": { 279 "added": [ 280 "v11.0.0" 281 ], 282 "changes": [] 283 }, 284 "type": "global", 285 "desc": "<p>The WHATWG <code>TextEncoder</code> class. See the <a href=\"util.html#util_class_util_textencoder\"><code>TextEncoder</code></a> section.</p>" 286 }, 287 { 288 "textRaw": "`URL`", 289 "name": "`URL`", 290 "meta": { 291 "added": [ 292 "v10.0.0" 293 ], 294 "changes": [] 295 }, 296 "type": "global", 297 "desc": "<p>The WHATWG <code>URL</code> class. See the <a href=\"url.html#url_class_url\"><code>URL</code></a> section.</p>" 298 }, 299 { 300 "textRaw": "`URLSearchParams`", 301 "name": "`URLSearchParams`", 302 "meta": { 303 "added": [ 304 "v10.0.0" 305 ], 306 "changes": [] 307 }, 308 "type": "global", 309 "desc": "<p>The WHATWG <code>URLSearchParams</code> class. See the <a href=\"url.html#url_class_urlsearchparams\"><code>URLSearchParams</code></a> section.</p>" 310 }, 311 { 312 "textRaw": "`WebAssembly`", 313 "name": "`WebAssembly`", 314 "meta": { 315 "added": [ 316 "v8.0.0" 317 ], 318 "changes": [] 319 }, 320 "type": "global", 321 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a></li>\n</ul>\n<p>The object that acts as the namespace for all W3C\n<a href=\"https://webassembly.org\">WebAssembly</a> related functionality. See the\n<a href=\"https://developer.mozilla.org/en-US/docs/WebAssembly\">Mozilla Developer Network</a> for usage and compatibility.</p>" 322 } 323 ], 324 "methods": [ 325 { 326 "textRaw": "`require()`", 327 "type": "method", 328 "name": "require", 329 "signatures": [ 330 { 331 "params": [] 332 } 333 ], 334 "desc": "<p>This variable may appear to be global but is not. See <a href=\"modules.html#modules_require_id\"><code>require()</code></a>.</p>" 335 } 336 ], 337 "miscs": [ 338 { 339 "textRaw": "Global objects", 340 "name": "Global objects", 341 "introduced_in": "v0.10.0", 342 "type": "misc", 343 "desc": "<p>These objects are available in all modules. The following variables may appear\nto be global but are not. They exist only in the scope of modules, see the\n<a href=\"modules.html\">module system documentation</a>:</p>\n<ul>\n<li><a href=\"modules.html#modules_dirname\"><code>__dirname</code></a></li>\n<li><a href=\"modules.html#modules_filename\"><code>__filename</code></a></li>\n<li><a href=\"modules.html#modules_exports\"><code>exports</code></a></li>\n<li><a href=\"modules.html#modules_module\"><code>module</code></a></li>\n<li><a href=\"modules.html#modules_require_id\"><code>require()</code></a></li>\n</ul>\n<p>The objects listed here are specific to Node.js. There are <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\">built-in objects</a>\nthat are part of the JavaScript language itself, which are also globally\naccessible.</p>", 344 "globals": [ 345 { 346 "textRaw": "Class: `AbortController`", 347 "type": "global", 348 "name": "AbortController", 349 "meta": { 350 "added": [ 351 "v14.17.0" 352 ], 353 "changes": [] 354 }, 355 "stability": 1, 356 "stabilityText": "Experimental", 357 "desc": "<p>A utility class used to signal cancelation in selected <code>Promise</code>-based APIs.\nThe API is based on the Web API <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/AbortController\"><code>AbortController</code></a>.</p>\n<p>To use, launch Node.js using the <code>--experimental-abortcontroller</code> flag.</p>\n<pre><code class=\"language-js\">const ac = new AbortController();\n\nac.signal.addEventListener('abort', () => console.log('Aborted!'),\n { once: true });\n\nac.abort();\n\nconsole.log(ac.signal.aborted); // Prints True\n</code></pre>", 358 "methods": [ 359 { 360 "textRaw": "`abortController.abort()`", 361 "type": "method", 362 "name": "abort", 363 "meta": { 364 "added": [ 365 "v14.17.0" 366 ], 367 "changes": [] 368 }, 369 "signatures": [ 370 { 371 "params": [] 372 } 373 ], 374 "desc": "<p>Triggers the abort signal, causing the <code>abortController.signal</code> to emit\nthe <code>'abort'</code> event.</p>" 375 } 376 ], 377 "properties": [ 378 { 379 "textRaw": "`signal` Type: {AbortSignal}", 380 "type": "AbortSignal", 381 "name": "Type", 382 "meta": { 383 "added": [ 384 "v14.17.0" 385 ], 386 "changes": [] 387 } 388 } 389 ], 390 "classes": [ 391 { 392 "textRaw": "Class: `AbortSignal`", 393 "type": "class", 394 "name": "AbortSignal", 395 "meta": { 396 "added": [ 397 "v14.17.0" 398 ], 399 "changes": [] 400 }, 401 "desc": "<ul>\n<li>Extends: <a href=\"events.html#events_class_eventtarget\" class=\"type\"><EventTarget></a></li>\n</ul>\n<p>The <code>AbortSignal</code> is used to notify observers when the\n<code>abortController.abort()</code> method is called.</p>", 402 "classMethods": [ 403 { 404 "textRaw": "Static method: `AbortSignal.abort()`", 405 "type": "classMethod", 406 "name": "abort", 407 "meta": { 408 "added": [ 409 "v14.17.0" 410 ], 411 "changes": [] 412 }, 413 "signatures": [ 414 { 415 "return": { 416 "textRaw": "Returns: {AbortSignal}", 417 "name": "return", 418 "type": "AbortSignal" 419 }, 420 "params": [] 421 } 422 ], 423 "desc": "<p>Returns a new already aborted <code>AbortSignal</code>.</p>" 424 } 425 ], 426 "events": [ 427 { 428 "textRaw": "Event: `'abort'`", 429 "type": "event", 430 "name": "abort", 431 "meta": { 432 "added": [ 433 "v14.17.0" 434 ], 435 "changes": [] 436 }, 437 "params": [], 438 "desc": "<p>The <code>'abort'</code> event is emitted when the <code>abortController.abort()</code> method\nis called. The callback is invoked with a single object argument with a\nsingle <code>type</code> property set to <code>'abort'</code>:</p>\n<pre><code class=\"language-js\">const ac = new AbortController();\n\n// Use either the onabort property...\nac.signal.onabort = () => console.log('aborted!');\n\n// Or the EventTarget API...\nac.signal.addEventListener('abort', (event) => {\n console.log(event.type); // Prints 'abort'\n}, { once: true });\n\nac.abort();\n</code></pre>\n<p>The <code>AbortController</code> with which the <code>AbortSignal</code> is associated will only\never trigger the <code>'abort'</code> event once. We recommended that code check\nthat the <code>abortSignal.aborted</code> attribute is <code>false</code> before adding an <code>'abort'</code>\nevent listener.</p>\n<p>Any event listeners attached to the <code>AbortSignal</code> should use the\n<code>{ once: true }</code> option (or, if using the <code>EventEmitter</code> APIs to attach a\nlistener, use the <code>once()</code> method) to ensure that the event listener is\nremoved as soon as the <code>'abort'</code> event is handled. Failure to do so may\nresult in memory leaks.</p>" 439 } 440 ], 441 "properties": [ 442 { 443 "textRaw": "`aborted` Type: {boolean} True after the `AbortController` has been aborted.", 444 "type": "boolean", 445 "name": "Type", 446 "meta": { 447 "added": [ 448 "v14.17.0" 449 ], 450 "changes": [] 451 }, 452 "desc": "True after the `AbortController` has been aborted." 453 }, 454 { 455 "textRaw": "`onabort` Type: {Function}", 456 "type": "Function", 457 "name": "Type", 458 "meta": { 459 "added": [ 460 "v14.17.0" 461 ], 462 "changes": [] 463 }, 464 "desc": "<p>An optional callback function that may be set by user code to be notified\nwhen the <code>abortController.abort()</code> function has been called.</p>" 465 } 466 ] 467 } 468 ] 469 }, 470 { 471 "textRaw": "Class: `Buffer`", 472 "type": "global", 473 "name": "Buffer", 474 "meta": { 475 "added": [ 476 "v0.1.103" 477 ], 478 "changes": [] 479 }, 480 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function\" class=\"type\"><Function></a></li>\n</ul>\n<p>Used to handle binary data. See the <a href=\"buffer.html\">buffer section</a>.</p>" 481 }, 482 { 483 "textRaw": "`clearImmediate(immediateObject)`", 484 "type": "global", 485 "name": "clearImmediate", 486 "meta": { 487 "added": [ 488 "v0.9.1" 489 ], 490 "changes": [] 491 }, 492 "desc": "<p><a href=\"timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 493 }, 494 { 495 "textRaw": "`clearInterval(intervalObject)`", 496 "type": "global", 497 "name": "clearInterval", 498 "meta": { 499 "added": [ 500 "v0.0.1" 501 ], 502 "changes": [] 503 }, 504 "desc": "<p><a href=\"timers.html#timers_clearinterval_timeout\"><code>clearInterval</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 505 }, 506 { 507 "textRaw": "`clearTimeout(timeoutObject)`", 508 "type": "global", 509 "name": "clearTimeout", 510 "meta": { 511 "added": [ 512 "v0.0.1" 513 ], 514 "changes": [] 515 }, 516 "desc": "<p><a href=\"timers.html#timers_cleartimeout_timeout\"><code>clearTimeout</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 517 }, 518 { 519 "textRaw": "`console`", 520 "name": "`console`", 521 "meta": { 522 "added": [ 523 "v0.1.100" 524 ], 525 "changes": [] 526 }, 527 "type": "global", 528 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a></li>\n</ul>\n<p>Used to print to stdout and stderr. See the <a href=\"console.html\"><code>console</code></a> section.</p>" 529 }, 530 { 531 "textRaw": "`global`", 532 "name": "`global`", 533 "meta": { 534 "added": [ 535 "v0.1.27" 536 ], 537 "changes": [] 538 }, 539 "type": "global", 540 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a> The global namespace object.</li>\n</ul>\n<p>In browsers, the top-level scope is the global scope. This means that\nwithin the browser <code>var something</code> will define a new global variable. In\nNode.js this is different. The top-level scope is not the global scope;\n<code>var something</code> inside a Node.js module will be local to that module.</p>" 541 }, 542 { 543 "textRaw": "`process`", 544 "name": "`process`", 545 "meta": { 546 "added": [ 547 "v0.1.7" 548 ], 549 "changes": [] 550 }, 551 "type": "global", 552 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a></li>\n</ul>\n<p>The process object. See the <a href=\"process.html#process_process\"><code>process</code> object</a> section.</p>" 553 }, 554 { 555 "textRaw": "`queueMicrotask(callback)`", 556 "type": "global", 557 "name": "queueMicrotask", 558 "meta": { 559 "added": [ 560 "v11.0.0" 561 ], 562 "changes": [] 563 }, 564 "desc": "<ul>\n<li><code>callback</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function\" class=\"type\"><Function></a> Function to be queued.</li>\n</ul>\n<p>The <code>queueMicrotask()</code> method queues a microtask to invoke <code>callback</code>. If\n<code>callback</code> throws an exception, the <a href=\"process.html#process_process\"><code>process</code> object</a> <code>'uncaughtException'</code>\nevent will be emitted.</p>\n<p>The microtask queue is managed by V8 and may be used in a similar manner to\nthe <a href=\"process.html#process_process_nexttick_callback_args\"><code>process.nextTick()</code></a> queue, which is managed by Node.js. The\n<code>process.nextTick()</code> queue is always processed before the microtask queue\nwithin each turn of the Node.js event loop.</p>\n<pre><code class=\"language-js\">// Here, `queueMicrotask()` is used to ensure the 'load' event is always\n// emitted asynchronously, and therefore consistently. Using\n// `process.nextTick()` here would result in the 'load' event always emitting\n// before any other promise jobs.\n\nDataHandler.prototype.load = async function load(key) {\n const hit = this._cache.get(key);\n if (hit !== undefined) {\n queueMicrotask(() => {\n this.emit('load', hit);\n });\n return;\n }\n\n const data = await fetchData(key);\n this._cache.set(key, data);\n this.emit('load', data);\n};\n</code></pre>" 565 }, 566 { 567 "textRaw": "`setImmediate(callback[, ...args])`", 568 "type": "global", 569 "name": "setImmediate", 570 "meta": { 571 "added": [ 572 "v0.9.1" 573 ], 574 "changes": [] 575 }, 576 "desc": "<p><a href=\"timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 577 }, 578 { 579 "textRaw": "`setInterval(callback, delay[, ...args])`", 580 "type": "global", 581 "name": "setInterval", 582 "meta": { 583 "added": [ 584 "v0.0.1" 585 ], 586 "changes": [] 587 }, 588 "desc": "<p><a href=\"timers.html#timers_setinterval_callback_delay_args\"><code>setInterval</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 589 }, 590 { 591 "textRaw": "`setTimeout(callback, delay[, ...args])`", 592 "type": "global", 593 "name": "setTimeout", 594 "meta": { 595 "added": [ 596 "v0.0.1" 597 ], 598 "changes": [] 599 }, 600 "desc": "<p><a href=\"timers.html#timers_settimeout_callback_delay_args\"><code>setTimeout</code></a> is described in the <a href=\"timers.html\">timers</a> section.</p>" 601 }, 602 { 603 "textRaw": "`TextDecoder`", 604 "name": "`TextDecoder`", 605 "meta": { 606 "added": [ 607 "v11.0.0" 608 ], 609 "changes": [] 610 }, 611 "type": "global", 612 "desc": "<p>The WHATWG <code>TextDecoder</code> class. See the <a href=\"util.html#util_class_util_textdecoder\"><code>TextDecoder</code></a> section.</p>" 613 }, 614 { 615 "textRaw": "`TextEncoder`", 616 "name": "`TextEncoder`", 617 "meta": { 618 "added": [ 619 "v11.0.0" 620 ], 621 "changes": [] 622 }, 623 "type": "global", 624 "desc": "<p>The WHATWG <code>TextEncoder</code> class. See the <a href=\"util.html#util_class_util_textencoder\"><code>TextEncoder</code></a> section.</p>" 625 }, 626 { 627 "textRaw": "`URL`", 628 "name": "`URL`", 629 "meta": { 630 "added": [ 631 "v10.0.0" 632 ], 633 "changes": [] 634 }, 635 "type": "global", 636 "desc": "<p>The WHATWG <code>URL</code> class. See the <a href=\"url.html#url_class_url\"><code>URL</code></a> section.</p>" 637 }, 638 { 639 "textRaw": "`URLSearchParams`", 640 "name": "`URLSearchParams`", 641 "meta": { 642 "added": [ 643 "v10.0.0" 644 ], 645 "changes": [] 646 }, 647 "type": "global", 648 "desc": "<p>The WHATWG <code>URLSearchParams</code> class. See the <a href=\"url.html#url_class_urlsearchparams\"><code>URLSearchParams</code></a> section.</p>" 649 }, 650 { 651 "textRaw": "`WebAssembly`", 652 "name": "`WebAssembly`", 653 "meta": { 654 "added": [ 655 "v8.0.0" 656 ], 657 "changes": [] 658 }, 659 "type": "global", 660 "desc": "<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\" class=\"type\"><Object></a></li>\n</ul>\n<p>The object that acts as the namespace for all W3C\n<a href=\"https://webassembly.org\">WebAssembly</a> related functionality. See the\n<a href=\"https://developer.mozilla.org/en-US/docs/WebAssembly\">Mozilla Developer Network</a> for usage and compatibility.</p>" 661 } 662 ], 663 "miscs": [ 664 { 665 "textRaw": "`__dirname`", 666 "name": "`__dirname`", 667 "desc": "<p>This variable may appear to be global but is not. See <a href=\"modules.html#modules_dirname\"><code>__dirname</code></a>.</p>", 668 "type": "misc", 669 "displayName": "`__dirname`" 670 }, 671 { 672 "textRaw": "`__filename`", 673 "name": "`__filename`", 674 "desc": "<p>This variable may appear to be global but is not. See <a href=\"modules.html#modules_filename\"><code>__filename</code></a>.</p>", 675 "type": "misc", 676 "displayName": "`__filename`" 677 }, 678 { 679 "textRaw": "`exports`", 680 "name": "`exports`", 681 "desc": "<p>This variable may appear to be global but is not. See <a href=\"modules.html#modules_exports\"><code>exports</code></a>.</p>", 682 "type": "misc", 683 "displayName": "`exports`" 684 }, 685 { 686 "textRaw": "`module`", 687 "name": "`module`", 688 "desc": "<p>This variable may appear to be global but is not. See <a href=\"modules.html#modules_module\"><code>module</code></a>.</p>", 689 "type": "misc", 690 "displayName": "`module`" 691 } 692 ], 693 "methods": [ 694 { 695 "textRaw": "`require()`", 696 "type": "method", 697 "name": "require", 698 "signatures": [ 699 { 700 "params": [] 701 } 702 ], 703 "desc": "<p>This variable may appear to be global but is not. See <a href=\"modules.html#modules_require_id\"><code>require()</code></a>.</p>" 704 } 705 ] 706 } 707 ] 708}