Skip to content

dispatch: return dispatchEvent result to caller #4

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

Closed
amarajs opened this issue May 25, 2018 · 2 comments
Closed

dispatch: return dispatchEvent result to caller #4

amarajs opened this issue May 25, 2018 · 2 comments

Comments

@amarajs
Copy link
Collaborator

amarajs commented May 25, 2018

This is an excellent library -- thank you for writing it. How would you feel about returning the result of dispatch to callers? If the event is cancelable and at least one handler invokes preventDefault(), the return value of dispatchEvent will be false, which could be important to know.

hybrids/src/utils.js

Lines 10 to 11 in 743caeb

export function dispatch(host, eventType, options = {}) {
host.dispatchEvent(new CustomEvent(eventType, { bubbles: false, ...options }));

If you think this is a good idea but don't have time to work on it, let me know and I'll create a PR with the code change, updated README documentation, and unit tests.

@smalluban
Copy link
Contributor

Thank you for comment about the library - it is very encouraging to do more :) Actually, I never have used returned value of dispatchEvent, so I have to say I didn't notice, that it returns something meaningful.

For the change, is up to you, it is a trivial, but maybe you want to have your first commit, so your welcome to create PR :) If not, I will push it.

@smalluban
Copy link
Contributor

smalluban commented May 26, 2018

Yesterday I found a bug related to invalidation propagation, which is already pushed. I will release a new version today, so I will push a change with dispatchEvent as well. You don't have to create PR.

@smalluban smalluban changed the title request: return dispatchEvent result to caller dispatch: return dispatchEvent result to caller Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants