Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What version of ECMAScript can we assume if we have web workers?

We are creating a javascript client app that uses web workers. We will only run on browsers that support web workers.

What version of ECMAScript can we assume those browsers support? Do they all support version 5?

like image 222
David Thielen Avatar asked Sep 30 '22 17:09

David Thielen


1 Answers

Web Workers were pulled out of the ECMAScript 5 standard. Instead, they are currently defined in an editors draft, which is not linked to a specific version of ECMAScript.

Basically, you can't assume a particular version.

If typeof window.Worker === 'function', you can assume the browser has some Web Worker support; but be aware of the perils of working with them.

caniuse.com shows the following level of support for Web Workers (at the time of writing...):

  • IE >= 10.0
  • Firefox >= 3.5
  • Chrome >= 4
  • Safari >= 4.0
  • Opera >= 10.6

But again, I strongly recommend you feature detect rather than browser sniff.

Even if Web Workers were linked to a specific ECMAScript version, a browser never really conforms to a particular version as you might think. A browser might fully support one ECMASCript 5 feature, partially support another, have buggy support in another, whilst not support another at all.

like image 69
Matt Avatar answered Oct 04 '22 17:10

Matt