Skip to content

Commit 6b59efd

Browse files
committed
Dispatch 'done' event after '_pollAgain'.
This allows 'close' called from a 'done' handler to cancel the upcoming reconnection. Otherwise '_pollTimer' will get reset after the handler.
1 parent 4cb56a7 commit 6b59efd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/EventSource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ class EventSource {
116116
this._handleEvent(xhr.responseText || '');
117117

118118
if (xhr.readyState === XMLHttpRequest.DONE) {
119-
this.dispatch('done', { type: 'done' });
120119
this._logDebug('[EventSource][onreadystatechange][DONE] Operation done.');
121120
this._pollAgain(this.interval, false);
121+
this.dispatch('done', { type: 'done' });
122122
}
123123
} else if (xhr.status !== 0) {
124124
this.status = this.ERROR;

0 commit comments

Comments
 (0)