developit / greenlet

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

Add support for Edge, Safari #38

Closed spkellydev closed 4 years ago

spkellydev commented 5 years ago

Edge throws a SecurityError when the function is inlined. Additionally, Edge doesn't have support for ImageBitmap. I didn't see any reason why the library should support ImageBitmap other than a small performance boost for supported browsers. Supporting Edge, I think, should be more of a priority than a possible performance boost for the other browsers.

Creating a blob object URL for the function will bypass the Edge security monitors and provides the same async/await functionality the library is designed for! This merge would resolve #34 let me know what you think!

Codesandbox link: https://codesandbox.io/s/p5ro71xxpm

spkellydev commented 5 years ago

It looks like the CI pipeline fails when webpack is not in package.json. Webpack was moved out of karmatic dependenices in Jun 2018

TimvanScherpenzeel commented 5 years ago

Perhaps beyond the scope of this PR but I've noticed that JSFiddle in the README does not work on iOS Safari. It appears to not log anything: https://jsfiddle.net/developit/mf9fbma5/. I'm unsure why as it appears to create the worker without any issue.

Edit:

I've looked a bit more into it and it appears that the onmessage event in the Worker is never fired on iOS Safari. Safari on desktop works fine however.

Edit:

After looking more into it this morning and physically connection the device it works fine now. So never mind my comments about iOS Safari.

spkellydev commented 5 years ago

Any status on this PR?

developit commented 5 years ago

Sorry for the slow response @TimvanScherpenzeel.

spkellydev commented 4 years ago

Anything I can do to help with this PR?

developit commented 4 years ago

Nothing on your part, sorry for the delay! I've finally had a chance to look through the history here and I think we're okay to go back to blobs.

The build errors are just coverage breaking, I'll fix that on master.