In addition to the standard JavaScript set of functions (such as String, Array, Object, JSON etc), there are a variety of functions available from the DOM to workers. This article provides a list of those.

Workers run in another global context, DedicatedWorkerGlobalScope different from the current window. By default methods and properties of Window are not available to them, but DedicatedWorkerGlobalScope, like Window, implements WindowTimers and WindowBase64.

Comparison of the properties and methods of the different type of workers

Function Dedicated workers Shared workers Service workers Chrome workers Outside workers
atob() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
btoa() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
clearInterval() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
clearTimeout() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
dump() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
setInterval() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
setTimeout() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on Window
importScripts() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, on WorkerGlobalScope no
close() yes, on WorkerGlobalScope yes, on WorkerGlobalScope yes, but is a no-op. Unknown no
postMessage() yes, on DedicatedWorkerGlobalScope no no Unknown no

APIs available in workers

Function Functionality Support in Gecko (Firefox) Support in IE Support in Blink (Chrome and Opera) Support in WebKit (Safari)
Broadcast Channel API Allows simple communication between browsing contexts (that is windows, tabs, frames, or iframes) with the same origin (usually pages from the same site). 38 (38) Not supported Not supported Not supported
Cache Cache API provides the ability to programmatically control cache storage associated with current origin. (Yes) Not supported 43 ?
Channel Messaging API Allows two separate scripts running in different browsing contexts attached to the same document (e.g., two IFrames, or the main document and an IFrame, two documents via a SharedWorker, or two workers) to communicate directly via two ports. 41 (41) (Yes) (Yes) (Yes)
Console API Provides access to the browser's debugging console (e.g., the Web Console in Firefox). The specifics of how it works vary from browser to browser, but there is a de facto set of features that are typically provided. 38 (38) (Yes) (Yes) (Yes)
Data Store A powerful, flexible storage mechanism for multiple Firefox OS applications to use to store and share data between one another quickly, efficiently, and securely. Only in Firefox OS internal (certified) applications, since v1.0.1. Not supported Not supported Not supported
DOMRequest and DOMCursor Respective, these objects represents an ongoing operation (with listeners for reacting to the operation completely successfully, or failing, for example), and an ongoing operation over a list of results. 41 (41) ? ? ?
Fetch The Fetch spec provides an up-to-date definition of, and API for, fetching resources (e.g. across the network.) Mostly in 34 (34) behind pref, although a few features are later. Not supported 42
41 behind pref
Not supported
FileReaderSync This API allows synchronous read of Blob and File objects. This is an API that works only in workers. 8 (8) Not supported Not supported Not supported
FormData FormData objects provide a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest send() method. ? (should be in 39 (39)) ? (Yes) ?
ImageData The underlying pixel data of an area of a canvas element. Manipulating such data can be a complex task better suited to be delegated to a Web Worker. 25 (25) Not supported Not supported Not supported
IndexedDB Database to store records holding simple values and hierarchical objects. 37 (37) 10.0 (Yes) Not supported
Notifications Allows web pages to control the display of system notifications to the end user 41 (41) ? ? ?
Performance The Performance interface represents timing-related performance information for the given page. 34.0 (34.0) ? 33.0 ?
Promise JavaScript objects that allow you to write asynchronous functions. 28 (28) (Yes) (Yes) (Yes)
ServiceWorkerRegistration You can register a service worker from inside a standard worker, and use associated functionality. 40 (40) Not supported (Yes) Not supported
TextEncoder and TextDecoder Create and return a new TextEncoder, or respectively TextDecoder, allowing to encode or decode strings into specific encodings. 20 (20) Not supported Not supported Not supported
URL Workers can use the static methods URL.createObjectURL and URL.revokeObjectURL with Blob objects accesible to the worker.
Workers can also create a new URL using the URL() constructor and call any normal method on the returned object.
21 (21) and 26 (26) for URL() constructor Not supported Not supported Not supported
WebSocket Creates and returns a new WebSocket  object; this mimics the behavior of the standard WebSocket() constructor. 37 (37) 11.0 (Yes) (Yes)
Worker Creates a new Worker. Yes, workers can spawn more workers. 3.5 (1.9.1) 10.0 Not supported See crbug.com/31666 Not supported
WorkerGlobalScope The global scope of workers. This objects defines worker-specific functions. (Yes) 10.0 (Yes) (Yes)
WorkerLocation The subset of the Location interface available to workers. 3.6 (1.9.2) 10.0 (Yes) (Yes)
WorkerNavigator The subset of the Navigator interface available to workers. Basic implementation (Yes)
appCodeName, product, taintEnabled(): 28 (28)
onLine: 29 (29)
NavigatorLanguage: Not supported
appName, appName, onLine, platform, userAgent: 10.0
Other: Not supported
(Yes) (Yes)
XMLHttpRequest Creates and returns a new XMLHttpRequest  object; this mimics the behavior of the standard XMLHttpRequest() constructor. Note that the responseXML and channel attributes on XMLHttpRequest always return null.

Basic: 3.5 (1.9.1)

response and responseType are available since 10 (10)

timeout and ontimeout are available since 13 (13)

(Yes) (Yes) (Yes)

See also