Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Globals

Index of every global available in scripts - fetch, console, sleep, toDateTime, ensureLatin and CryptoJS - with links to their reference pages.

A global is a name that is available in every script file, without an import. The platform provides a small, fixed set: one function to call external systems, a few helpers for text, dates, waiting and signing, and a console for logging. Capabilities that are not globals are modules: getSecret, the Secutix fetch and semantics (Apple Music).

List of globals

Global
What it does
Reference

fetch(url, options?)

Sends an HTTP request and returns { StatusCode, ResponseText }. Supports authentication, caching and throttling.

console

Writes to the platform's log: log, debug, trace, table, info, warn, assert, error.

sleep(ms)

Returns a promise that resolves after a delay.

toDateTime(value)

Converts a string or a JavaScript date to a UTC date, or null.

ensureLatin(value, replacement?)

Turns look-alike and accented characters into plain Latin letters.

CryptoJS.HmacSHA256(secret, value)

Computes an HMAC-SHA256 signature as uppercase hexadecimal text.

Other names that the editor shows in a handler, such as context in the default export, are parameters handed to the script and not globals. The standard JavaScript built-ins (JSON, Math, Date, Array, and so on) are available as usual.

Rules that apply to all globals

Globals that can be awaited (fetch, sleep) return promises, so handlers that use them are written with async and await. Globals keep no state between runs; reuse data with the Cache option of fetch (see How scripts run).

FAQ

Is there a `setTimeout` or `setInterval`?

They are not part of the documented set. A pause is written with await sleep(ms), and recurring work belongs to the scheduler of the platform rather than to a script.

Last updated