-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
on:* #3349
on:* #3349
Conversation
@@ -17,7 +17,7 @@ export default class EventHandler extends Node { | |||
constructor(component: Component, parent, template_scope, info) { | |||
super(component, parent, template_scope, info); | |||
|
|||
this.name = info.name; | |||
this.name = info.name !== '*' ? info.name : 'any'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would give on:any
a different meaning than it already has, which we don't want to do. It's possible that someone has code where they are bubbling an event called any
, and this would break it. I think elsewhere should just be looking for handler.name === '*'
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming to $$any
helped. Is it ok way this way?
src/runtime/internal/Component.ts
Outdated
@@ -43,6 +43,16 @@ export function mount_component(component, target, anchor) { | |||
run_all(new_on_destroy); | |||
} | |||
component.$$.on_mount = []; | |||
|
|||
if (fragment.bbl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm mistaken, this mechanism won't forward events with handlers attached after the component has been mounted.
Demo is available here: https://public-mo2fyuk8g.now.sh/. I couldn't find another way but to write block specific code (so far each and if) to push up elements with |
Here's component I'm testing on:
What other cases should I consider besides |
One more thing. |
Codecov Report
@@ Coverage Diff @@
## master #3349 +/- ##
=======================================
Coverage 50.25% 50.25%
=======================================
Files 1 1
Lines 197 197
=======================================
Hits 99 99
Misses 98 98 Continue to review full report at Codecov.
|
Anything I can do to stop being ignored? |
@matyunya I was able to compile your specific package locally and tried an event forwarding with the example given at https://svelte.dev/tutorial/event-forwarding, and instead of using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that is still desired?
The code needs to be rewritten since this was done before code-red and ast stuff was merged.
I'd recommend also branching for PR instead of submitting from master. It makes rework and rebasing much easier.
I made the first step here and wanted to hear feedback if my direction is right. Will make another round now. |
You really should do a branch since there's now commit pollution on this PR from your other When I first looked at the notification email for this PR, it said there were 200+ commits added, which is pretty good sign that the workflow is a off somewhere. See if you can untangle this from the other PRs so it can get a proper review. |
My bad. I will recreate my fork and put the two features in different branches. But given the diff with master, I'll have to do my work on |
@matyunya Any news here? Seems it's the most wanted feature at the current moment. |
Yeah. Ability to forward all events not only from a DOM-node but also through components is really REALLY necessary. |
I believe this is the PR that was considered last for this feature, pending a review from another core team member: #4599 |
#2837
This is first iteration of
on:*
to enable forwarding arbitrary events for components.