Skip to content

Conversation

stefdev49
Copy link

Hello,

these changes (somehow similar to #8) are the minimal ones I had to do to get FetchEventSource working in a web worker context.
I've also added some unit tests to validate these changes.

With it one can use FetchEventSource in a WebWorker by settings these parameters :

fetchEventSource('https://myurl', {
    openWhenHidden: true,
    fetch: self.fetch,
    .....

- when openWhenHidden is true, the event listener is not added. So don't remove
  it in dispose().
  This helps the webworker use case where document does not exist, but
  can be worked around by setting openWhenHidden to true.
- self will work in both browser window and webworker context
@ghost
Copy link

ghost commented Jul 1, 2022

CLA assistant check
All CLA requirements met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant