-
Notifications
You must be signed in to change notification settings - Fork 40
Add done
event
#63
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
Add done
event
#63
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ class EventSource { | |
open: [], | ||
message: [], | ||
error: [], | ||
done: [], | ||
close: [], | ||
}; | ||
|
||
|
@@ -115,6 +116,7 @@ class EventSource { | |
this._handleEvent(xhr.responseText || ''); | ||
|
||
if (xhr.readyState === XMLHttpRequest.DONE) { | ||
this.dispatch('done', { type: 'done' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would strongly recommend to dispatch the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. I just updated and tested that it works as expected. |
||
this._logDebug('[EventSource][onreadystatechange][DONE] Operation done.'); | ||
this._pollAgain(this.interval, false); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be rephrased slightly to make it more clear. Maybe something like:
By default, the client will automatically reconnect when this happens. You can disable the reconnections by setting the
pollingInterval
option to 0".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. Updated.