Global Objects
These objects are available in all modules. Some of these objects aren’t actually in the global scope but in the module scope.Global Variables
The following variables may appear to be global but exist only in the scope of CommonJS modules:__dirname__filenameexportsmodulerequire()
Class: AbortController
Added in: v15.0.0, v14.17.0
abortController.abort([reason])
An optional reason, retrievable on the AbortSignal’s reason property.
abortController.signal to emit the ‘abort’ event.
abortController.signal
The AbortSignal object associated with this AbortController.
Class: AbortSignal
Extends: EventTarget The AbortSignal is used to notify observers when theabortController.abort() method is called.
Static Methods
AbortSignal.abort([reason])
Optional reason for aborting.
AbortSignal.timeout(delay)
The number of milliseconds to wait before triggering the AbortSignal.
delay milliseconds.
AbortSignal.any(signals)
The AbortSignals of which to compose a new AbortSignal.
Event: ‘abort’
The ‘abort’ event is emitted when theabortController.abort() method is called.
abortSignal.aborted
True after the AbortController has been aborted.
abortSignal.reason
An optional reason specified when the AbortSignal was triggered.
abortSignal.throwIfAborted()
IfabortSignal.aborted is true, throws abortSignal.reason.
Class: Buffer
Added in: v0.1.103
console
fetch
Added in: v17.5.0, v16.15.0. No longer experimental in v21.0.0.
fetch() function.
Related Classes
The following globals are available to use with fetch:FormDataHeadersRequestResponse
global
The global namespace object.
var something inside a Node.js module will be local to that module.
performance
Added in: v16.0.0
perf_hooks.performance object.
process
Added in: v0.1.7
queueMicrotask(callback)
Added in: v11.0.0
Function to be queued.
queueMicrotask() method queues a microtask to invoke callback. If callback throws an exception, the process object 'uncaughtException' event will be emitted.
The microtask queue is managed by V8 and may be used in a similar manner to the process.nextTick() queue, which is managed by Node.js. The process.nextTick() queue is always processed before the microtask queue within each turn of the Node.js event loop.
Timer Functions
setImmediate(callback[, …args])
Added in: v0.9.1
The function to call at the end of this turn of the event loop.
Optional arguments to pass when the callback is called.
setInterval(callback, delay[, …args])
Added in: v0.0.1
The function to call when the timer elapses.
The number of milliseconds to wait before calling the callback. Default: 1.
setTimeout(callback, delay[, …args])
Added in: v0.0.1
The function to call when the timer elapses.
The number of milliseconds to wait before calling the callback. Default: 1.
clearImmediate(immediateObject)
Added in: v0.9.1
setImmediate().
clearInterval(intervalObject)
Added in: v0.0.1
setInterval().
clearTimeout(timeoutObject)
Added in: v0.0.1
setTimeout().
URL
Added in: v10.0.0
URL class.
URLSearchParams
Added in: v10.0.0
URLSearchParams class.
WebAssembly
Added in: v8.0.0
The object that acts as the namespace for all W3C WebAssembly related functionality.