-
Notifications
You must be signed in to change notification settings - Fork 446
Use MessageEvent in EventSource#addEventListener #1182
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
Conversation
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
This is redefining too many things. Since this case is special enough I would just hardcode the event type in the function generating If you prefer not to hardcode, you can maybe add some field |
fb11228
to
19043f2
Compare
Thanks, made that change. That is nicer indeed |
src/build/emitter.ts
Outdated
const listener = | ||
i.name === "EventSource" | ||
? "(this: EventSource, event: MessageEvent) => any" | ||
: "EventListenerOrEventListenerObject"; |
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.
Hmm, this potentially breaks compatibility with { handleEvent: () =>{} }
. Could you add another signature that accepts EventListenerObject, and add a unit test in unittests/files/
?
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.
Yeah you're right. I thought it would take the definition from the extends EventTarget
. I'll make it purely additive
Looks great, thank you! Just waiting for the tests to pass... |
LGTM |
Merging because @saschanaz is a code-owner of all the changes - thanks! |
Fixes #736
The event listeners are removed and then recreated to avoid having the
existing add/removeEventListeners in addition to the new ones