Programming API

Web Standard APIs

Zuplo's runtime supports the standards Web Workers API. This means that you can rely on the same set of Javascript APIs you would find in a browser environment.

Built-In Objects#

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.
  • Date.now() returns the time of the last I/O; it does not advance during code execution.

​​Compression Streams#

The CompressionStream and DecompressionStream classes support gzip and deflate compression methods.

Refer to the MDN documentation for more information

Cryptography#

The Web Crypto API enables the use cryptographic primitives in order to build systems using cryptography.

For more details see the Web Crypto documentation

Encoding API#

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

Refer to the MDN documentation for more information.

Encoding: Base64#

  • 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.

Fetch#

The Fetch API provides an interface for fetching resources (including across the network).

Refer to the MDN documentation for more information

const response = await fetch("https://echo.zuplo.io"); const body = await response.json();

The Fetch API includes standard objects like Headers, Request, and Response.

See Also: ZuploRequest

Streams API#

The Streams API allows JavaScript to programmatically access streams of data received over the network and process them as desired by the developer.

​​Timers#

  • 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().

URL#

The URL interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL.

Refer to the MDN documentation for more information

URLPattern API#

The URLPattern API provides a mechanism for matching URLs based on a convenient pattern syntax.

Refer to the MDN documentation for more information.

Previous
BackgroundDispatcher