Globals
The global constructors, functions, objects, and values that every Azion Runtime function can use without an import.
Azion Runtime gives every function a set of global names that the code uses without an import: JavaScript built-ins, Web APIs, the Azion APIs, and some Node.js globals. The lists on this page are the names the deployed runtime exposes, grouped by the type typeof returns for each. self and globalThis are the same object.
Constructors and functions
These globals are functions, so typeof returns function for each of them:
- Object
- Function
- Array
- Number
- parseFloat
- parseInt
- Boolean
- String
- Symbol
- Date
- Promise
- RegExp
- Error
- AggregateError
- EvalError
- RangeError
- ReferenceError
- SyntaxError
- TypeError
- URIError
- ArrayBuffer
- Uint8Array
- Int8Array
- Uint16Array
- Int16Array
- Uint32Array
- Int32Array
- Float32Array
- Float64Array
- Uint8ClampedArray
- BigUint64Array
- BigInt64Array
- DataView
- Map
- BigInt
- Set
- WeakMap
- WeakSet
- Proxy
- decodeURI
- decodeURIComponent
- encodeURI
- encodeURIComponent
- escape
- unescape
- isFinite
- isNaN
- Event
- EventTarget
- CustomEvent
- dispatchEvent
- addEventListener
- removeEventListener
- AbortSignal
- AbortController
- Blob
- Buffer: the Node.js
Bufferclass. For more information, refer to node. - Cache and CacheStorage: the classes of the Cache API.
- Crypto
- CryptoKey
- CountQueuingStrategy
- DOMException
- FormData
- Headers
- ReadableStream
- ReadableStreamBYOBReader
- ReadableStreamDefaultReader
- Request
- Response
- SubtleCrypto
- TextDecoder
- TextEncoder
- TransformStream
- URL
- URLPattern
- URLSearchParams
- WritableStream
- WritableStreamDefaultWriter
- atob
- btoa
- clearTimeout
- fetch
- setTimeout
- setInterval
- setImmediate
- clearImmediate
- structuredClone
- ExtendableEvent
- FetchEvent
- FirewallEvent
- clearInterval
- SharedArrayBuffer
- CompressionStream
- DecompressionStream
- TextDecoderStream
- TextEncoderStream
- upgradeWebSocket and WebSocket: the functions of the WebSocket API.
globalThis is an EventTarget, so the global addEventListener, removeEventListener, and dispatchEvent act on it.
ExtendableEvent, FetchEvent, and FirewallEvent are defined, but a function cannot construct them: new FetchEvent('fetch') throws TypeError: Illegal constructor. The runtime creates the FetchEvent that a fetch listener receives from addEventListener.
Objects
These globals are objects, so typeof returns object for each of them:
- globalThis
- JSON
- Math
- Intl
- Reflect
- console
- crypto
- self
- Atomics
- WebAssembly
- performance
- caches: the
CacheStorageinstance of the Cache API. - process: the Node.js
processobject. Itsprocess.envholds the environment variables of the account. For more information, refer to node. - Azion: the namespace of the Azion APIs, which reach environment variables, network lists, Object Storage, SQL Database, KV Store, and AI Inference.
Numeric values
These globals are numbers:
- Infinity
- NaN
Other values
| Global | Type | Value |
|---|---|---|
undefined | undefined | undefined |
EdgeRuntime | String | "azion" |
Time inside a request
In a deployed function, Date.now() returns the same value for the whole request. It does not advance across a loop, a timer, or a fetch() call, and its milliseconds read 0. To measure elapsed time inside a request, use performance.now(): it advances during the request and starts at 0.