You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Svelte greatly simplifies the code.
I miss the simplification of the recognition of a key or a mouse button - to make it even more transparent.
I'm trying on the line (maybe it's a bad idea, but I don't have a better one):
but this code is just... not very readable, and ugly.
Describe the solution you'd like
<!-- Mouse button modifiers (and @const in tag) -->
<button
on:mouseup|firstButton={()=>doSound(wave)}
on:mouseup|secondButton={()=>saveSound(wave)}
}>
<!-- Or maybe like a function? -->
<button
on:mouseup|button(0)={()=>doSound(wave)}
on:mouseup|button(1)={()=>saveSound(wave)}
}>
<!-- Key code modifiers -->
<svelte:window on:keydown|KeyA|KeyS|KeyD|KeyW={doSometing}/>
<!-- or from an array -->
{@const arr=["KeyA","KeyS","KeyD","KeyW"]}
<svelte:window on:keydown|{arr}={doSometing}/>
<!-- or like a function -->
<svelte:window on:keydown|keyCode(KeyA,KeyS,KeyD,KeyW)={doSometing}/>
<!-- or -->
{@const arr=["KeyA","KeyS","KeyD","KeyW"]}
<svelte:window on:keydown|keyCode(arr)={doSometing}/>
This came up before in #4427 and in other issues, and I still think that all the extra syntax (and extra documentation) that this would require is not worth it, compared to just doing this in javascript.
@Conduitry How can you say unequivocally "worth it" or "not worth it"? Is it such an arbitrary decision?
I understand the concept of svelte simplicity and support it very much.
But there aren't many places like the concept of modifiers with parameters - it's something simple and general. on:keydown|keyCode(KeyA,KeyS,KeyD,KeyW)
I will even say that there are a lot of things in svelte that can only be used occasionally, and sometimes you have to use a less neat version.
For example, you can bind:value
but there are situations where you cannot do without on:change={e=>value=e.target.value}
But we don't delete bind:value.
Such button and key modifiers would fit in perfectly.
Is your feature request related to a problem? Please describe.
Svelte greatly simplifies the code.
I miss the simplification of the recognition of a key or a mouse button - to make it even more transparent.
I'm trying on the line (maybe it's a bad idea, but I don't have a better one):
but this code is just... not very readable, and ugly.
Describe the solution you'd like
Describe alternatives you've considered
How important is this feature to you?
I use this on a daily basis so quite important.
The text was updated successfully, but these errors were encountered: