developit / greenlet

🦎 Move an async function into its own thread.
https://npm.im/greenlet
4.67k stars 100 forks source link

how does this library work in browsers which doesn't support web worker? #14

Closed yutro closed 6 years ago

TomasHubelbauer commented 6 years ago

Worker is assumed to be present and there is no feature detection, so you either polyfill it or it doesn't.

yutro commented 6 years ago

thanks!

MattSidor commented 6 years ago

Thankfully, Web Workers have been around for a while and are pretty broadly supported. IE10+ supports them.

https://caniuse.com/#feat=webworkers

If you still need to support older browsers, you can just check for the presence of window.Worker:

if (window.Worker) {
    ...
} else {
    ...
}
developit commented 6 years ago

Might be worth adding a section noting that to the readme if anyone wants to PR!

developit commented 6 years ago

It may also be possible to polyfill via jsdom-worker.