Wednesday, 19 September 2012

What new HTML5 Web Workers Can and Can’t Do...

Workers don’t have access to the DOM of the “parent” page. They can’t access any of
the following:

• The window object
• The document object
• The parent object
• They can’t use JavaScript libraries that depend on these objects to work, like jQuery.

Web Workers can access only a limited set of JavaScript’s features because of their
multi-threaded nature. Here is the set of features they can use:

• The navigator object
• The location object (read-only)
• The XMLHttpRequest function
• The atob() and btoa() functions for converting Base 64 ASCII to and from binary
data
• setTimeout() / clearTimeout() and setInterval() / clearInterval()
• dump()
• The application cache
• External scripts using the importScripts() method
• Spawning other Web Workers4

No comments:

Post a Comment