We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

Functions available to workers

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. Remember that workers run in another global context, DedicatedWorkerGlobalScope different from the current window.

Function Equivalent to...
atob() window.atob()
btoa() window.btoa()
clearInterval() window.clearInterval()
clearTimeout() window.clearTimeout()
dump() window.dump().
setInterval() window.setInterval()
setTimeout() window.setTimeout()

APIs available in workers

Function Functionality Support in Gecko (Firefox) Support in IE Support in Blink (Chrome) Support in WebKit (Safari)
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. The .response and .responseType properties are available since Firefox 10. Basic: 3.5 (1.9.1)
response and responseType are available since 10 (10)
Not supported (Yes) (Yes)
Worker Creates a new Worker. Yes, workers can span more workers. 3.5 (1.9.1) 10.0 Not supported See crbug.com/31666 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
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
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)
WorkerLocation The subset of the Location interface available to workers. 3.6 (1.9.2) 10.0 (Yes) (Yes)
WorkerGlobalScope The global scope of workers. This objects defines worker-specific functions. (Yes) 10.0 (Yes) (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
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
IndexedDB Database to store records holding simple values and hierarchical objects. Not supported 10.0 Not supported Not supported

Worker-specific functions

These functions make advanced functionality available to Workers, including support for AJAX requests and creating new workers from within your worker.

Function Functionality

Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example:

importScripts('foo.js', 'bar.js');

See also

Document Tags and Contributors

 Contributors to this page: teoli
 Last updated by: teoli,