You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixesmicrosoft#736
The event listeners are removed and then recreated to avoid having the
existing add/removeEventListeners in addition to the new ones
* Use MessageEvent in EventSource#addEventListener
Fixes#736
* Retain EventSource's original listener
* Add test for MessageEvent being the default overload
Right now,
EventSource.addEventListener
has the followingeventName => eventType
mapping:And all other events are given the
Event
type. However, any event can be given aMessageEvent
, e.g. given the following EventSource response:And the following code:
We'll get the following console output:
The trivial solution would be to have the signature
addEventListener(type: string, listener: (this: EventSource, ev: MessageEvent) => any, ...)
(omitted for brevity that the listener can also be an
EventListenerObject
receiving aMessageEvent
).I can send a PR if this seems like the right solution to you, I'm however a ts novice so maybe I'm missing a better solution?
Thanks.
The text was updated successfully, but these errors were encountered: