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

Implementation of stopImmediatePropagation #93

Open
boblund opened this issue Nov 4, 2024 · 2 comments
Open

Implementation of stopImmediatePropagation #93

boblund opened this issue Nov 4, 2024 · 2 comments

Comments

@boblund
Copy link

boblund commented Nov 4, 2024

I implemented stopImmediatePropagation with a really simple change. In the emit prototype loop that executes the listeners I check the ReflectApply return for the string 'stopImmediatePropagation'. To stop a event propagation the event handler then returns 'stopImmediatePropagation'.

Will this break something? Is there interest in adding this?

@boblund
Copy link
Author

boblund commented Nov 4, 2024

Here's the code change

    for (var i = 0; i < len; ++i)
      if( ReflectApply(listeners[i], this, args) === 'stopImmediatePropagation' ) break;

@goto-bus-stop
Copy link
Member

stopImmediatePropagation is part of the EventTarget API which is not supported by this module at the moment. Custom extensions outside of the Node.js API are out of scope. If we add this it should be part of the EventTarget API.

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

No branches or pull requests

2 participants