GitHub iconEdit on GitHub

Web Standards

The Workers Runtime provides the following standardized APIs for use by scripts running at the Edge.

JavaScript Standards

All of the standard built-in objects supported by the current Google Chrome stable release are supported, with a few notable exceptions:

  • eval() is not allowed for security reasons.
  • new Function is not allowed for security reasons.
  • returns the time of the last I/O; it does not advance during code execution.

Web Global APIs

The following methods are available per the Worker Global Scope:

Base64 Utility Methods

atob() - Decodes a string of data which has been encoded using base-64 encoding.

btoa() - Creates a base-64 encoded ASCII string from a string of binary data.


setInterval() - Schedules a function to execute every time a given number of milliseconds elapses.

clearInterval() - Cancels the repeated execution set using setInterval().

setTimeout() - Schedules a function to execute in a given amount of time.

clearTimeout() - Cancels the delayed execution set using setTimeout().

*Note: Timers are only available inside of the Request Context.

Fetch global

fetch() - Starts the process of fetching a resource from the network. See FetchAPI. *Note: The Fetch API is only available inside of the Request Context.

Encoding API

Both TextEncoder and TextDecoder support UTF-8 encoding/decoding.

Go to the docs


The URL API supports urls conforming to http and https schemes.

Go to the docs

Note: The Workers' Runtime's URL class behavior differs from the URL Spec documented above. If you'd like to use another URL implementation, you can shim the URL class using webpack.