The Workers Runtime provides the following standardized APIs for use by scripts running at the Edge.
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 Functionis not allowed for security reasons.
Date.now()returns the time of the last I/O; it does not advance during code execution.
The following methods are available per the Worker Global Scope:
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.
setTimeout() - Schedules a function to execute in a given amount of time.
*Note: Timers are only available inside of the Request Context.
Both TextEncoder and TextDecoder support UTF-8 encoding/decoding.
The URL API supports urls conforming to http and https schemes.