Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we add a 'done' event? #56

Open
daniel-bryant opened this issue Jun 2, 2024 · 1 comment
Open

Can we add a 'done' event? #56

daniel-bryant opened this issue Jun 2, 2024 · 1 comment

Comments

@daniel-bryant
Copy link

Thanks in advance! My usage looks like this.

es = new EventSource(url, {
  debug: debug,
  headers: headers,
  pollingInterval: 0, // Set pollingInterval to 0 to disable reconnections
})

I set pollingInterval to 0 as suggested in the README because otherwise it would reconnect and I don't need reconnections. However, I do want to know when the request "finishes".

The server closing does not trigger a close event, which seems to be by design. But I noticed [EventSource][onreadystatechange][DONE] Operation done. in the debug logs. That is exactly what I need to know in my code, but there's no event!

I forked the source locally, added the event, and things work perfectly 👌. The actual change is only a handful of lines, so I can easily make a PR. Just wanted to get a 👍 first.

@wojciechkrol
Copy link
Collaborator

Feel free to open PR

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

No branches or pull requests

2 participants