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. |
Worker() | Creates a new Note: Spawning nested Workers is currently not supported in Chrome: crbug.com/31666 |
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 |
importScripts() | Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example:
|
Worker-specific classes
These interfaces are only available to Workers:
FileReaderSync
that allows synchronous read ofBlob
orFile
.