mo / abortcontroller-polyfill

Polyfill for the AbortController DOM API and abortable fetch (stub that calls catch, doesn't actually abort request).
MIT License
328 stars 26 forks source link

Support web workers #11

Closed joaovieira closed 6 years ago

joaovieira commented 6 years ago

While working on https://github.com/github/fetch/pull/592 and bringing this in to have a full-featured polyfill for testing, I noticed it doesn't work inside a web worker as it uses the dom to create an EventTarget. Would you be willing to rework the Emitter class to support that?

screen shot 2018-02-02 at 01 16 20
getify commented 6 years ago

I've had to hack this polyfill to be able to run it in node... would be very helpful if this browser/DOM dependency could be refactored out. :)

joaovieira commented 6 years ago

I've also ended up having to implement an EventTarget here so I'm bringing that over.

Also noticed this polyfill doesn't use theAbortSignal.onabort handler defined in the spec.