Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Event subscriptions #42

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

Merged
merged 3 commits into from
Nov 12, 2019
Merged

Event subscriptions #42

merged 3 commits into from
Nov 12, 2019

Conversation

dgraham
Copy link
Contributor

@dgraham dgraham commented Nov 8, 2019

This branch expands the use of the event subscription pattern to handle removing all event listeners. There are enough listeners to warrant this now, and this would have prevented the copy/paste typo in #40 that should be calling removeEventListener.

In addition to listener cleanup, this binds listeners to the details and menu elements so they don't need to typecast or query the tree for them. The subscription pattern avoids tracking bound listener functions in the element's state so they may be deregistered later.

Removes null and type checking on event targets we know to be correct.
Consolidates adding and removing listeners into a subscription pattern.
Copy link
Contributor

@muan muan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Contributor

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

I really like the clean nature of subscriptions with cleanup, and the implementation to convert (add|remove)EventListener into them is neat 👍

@dgraham dgraham merged commit 0876179 into master Nov 12, 2019
@dgraham dgraham deleted the event-subscriptions branch November 12, 2019 17:16
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.

3 participants