Skip to content

Conversation

@Alexendoo
Copy link
Contributor

Fixes #736

The event listeners are removed and then recreated to avoid having the
existing add/removeEventListeners in addition to the new ones

@ghost
Copy link

ghost commented Oct 20, 2021

CLA assistant check
All CLA requirements met.

@github-actions
Copy link
Contributor

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.

@saschanaz
Copy link
Collaborator

saschanaz commented Oct 20, 2021

This is redefining too many things. Since this case is special enough I would just hardcode the event type in the function generating addEventListener.

If you prefer not to hardcode, you can maybe add some field defaultEventInterface and use that.

@Alexendoo
Copy link
Contributor Author

Thanks, made that change. That is nicer indeed

const listener =
i.name === "EventSource"
? "(this: EventSource, event: MessageEvent) => any"
: "EventListenerOrEventListenerObject";
Copy link
Collaborator

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/?

Copy link
Contributor Author

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

@saschanaz
Copy link
Collaborator

Looks great, thank you! Just waiting for the tests to pass...

@saschanaz
Copy link
Collaborator

LGTM

@github-actions github-actions bot merged commit 20c1354 into microsoft:main Oct 23, 2021
@github-actions
Copy link
Contributor

Merging because @saschanaz is a code-owner of all the changes - thanks!

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

Successfully merging this pull request may close these issues.

EventSource events are always provided a MessageEvent

2 participants