Skip to content
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

Allow Component to handle all event listeners without binding external #60

Merged

Conversation

todd-dembrey
Copy link
Contributor

@todd-dembrey todd-dembrey commented Feb 10, 2020

Wrap all events in a single handler which will delegate out the events to the
provided functions. This means that if the external function changes we do not
need to rebind the function, fixing issues with functional react components.

Fixes #49 and should be an improvement on #48

I'm not sure about the difference of binding to element and cornerstone so i bound to both - might be nice to refine this. Equally i no longer check the element that fired the event in _handleExternalEventListeners so would appreciate some feedback there.

@dannyrb dannyrb self-requested a review February 10, 2020 14:00
@dannyrb
Copy link
Member

dannyrb commented Feb 17, 2020

@todd-dembrey, if you update this on latest changes, I am more than happy to merge. Usage for binding to "elements" or "cornerstone.events" should be clearer in latest changes.

Some events are element specific, others are only emitted at the library level. We could probably simplify this so that all events could be listened to at cornerstone.events, but that would require a change to cornerstone-tools (more than happy to look at a PR if this is desired)

@todd-dembrey todd-dembrey force-pushed the bugfix/binding-of-event-listeners branch 4 times, most recently from 8e4f71b to aa39875 Compare February 17, 2020 20:04
Wrap all events in a single handler which will delegate out the events to the
provided functions. This means that if the external function changes we do not
need to rebind the function, fixing issues with functional react components.
@todd-dembrey todd-dembrey force-pushed the bugfix/binding-of-event-listeners branch from aa39875 to 8faa971 Compare February 17, 2020 20:06
@todd-dembrey
Copy link
Contributor Author

@dannyrb Rebased and updated based on #62

Copy link
Member

@dannyrb dannyrb left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@dannyrb dannyrb merged commit 73a1c73 into cornerstonejs:master Feb 17, 2020
@ohif-bot
Copy link

🎉 This PR is included in version 2.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Events passed as props are not fired
3 participants