Functions available to workers

DOM-related function available in 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.

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

DOM-related classes available in workers

Function Functionality
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.

Creates a new Worker . Yes, workers can create more workers.

Note: Spawning nested Workers is currently not supported in Chrome:

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');

Worker-specific classes

These interfaces are only available to Workers:

Browser compatibility

See Using web workers

Tags (1)

Edit tags

Attachments (0)


Attach file