-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add <svelte:this />
tag
#58
Conversation
I wouldn't deprecated the current API because your design suffers from one limitation: you can only get a single reference to each of the things. But there are pre-processors that dynamically need to use things like |
I propose one <svelte:this
on:destroy={localHandler}
on:destroy={preprocessorHandler}
on:destroy
bind:props={localProps}
bind:props={preprocessorPropVar}/> |
This is not valid. I don't know what parser Svelte uses, but none of Lifecycle functions also don't have to be inside a |
Binding to DOM elements needs attributes to be unique because I'm not sure if there's a technical reason why That said, I agree there is a case to be made for external code doing their own clean up and handling lifecycle events imperatively. |
I have a suggestion for <script>
function sayHello() {
testevent({
test: 'food'
});
}
</script>.
<svelte:this dispatch:testevent />
<div on:click={sayHello}>test</div>. That is with With Giving the name already in the attribute also makes it clearer. |
Instead of that, it could be possible that multiple bindings on atributes are seperated by commas. ie: <svelte:this
on:destroy={localHandler, preprocessorHandler}
bind:props={localProps, preprocessorPropVar}/> |
The comma is already an operator in JavaScript. Comma separated values returns the last value in a list. let foo = ("bar", "baz");
console.log(foo); // baz Tangentially, a debugging tip: do |
or make it possible for
|
|
Runes. |
- RFC PR: (leave this empty) | ||
- Svelte Issue: (leave this empty) | ||
|
||
# `<svelte:this/>` |
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.
Why it got left like this
Rendered