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

Spread event handlers #36

Open
bestguy opened this issue Aug 16, 2019 · 7 comments
Open

Spread event handlers #36

bestguy opened this issue Aug 16, 2019 · 7 comments
Assignees

Comments

@bestguy
Copy link
Owner

bestguy commented Aug 16, 2019

Looks like we don't support many props and event handlers unless specifically added to interface.

I need to catch up with Svelte 3 but doesn't look like it supports spread props ala React: {...props}. May need to add them all individually, although this Svelte PR seems to add on:* event support: sveltejs/svelte#3349

@bestguy
Copy link
Owner Author

bestguy commented Aug 20, 2019

Looks like Svelte does support this, but difficult to optimize:
https://svelte.dev/docs#Attributes_and_props

Ex:

<Widget {...$$props}/>

Probably should use this for now on all components to ensure usage is correct, then can optimize after.

@bestguy
Copy link
Owner Author

bestguy commented Aug 20, 2019

#40

@bestguy bestguy self-assigned this Aug 20, 2019
@bestguy
Copy link
Owner Author

bestguy commented Sep 5, 2019

#40 is merged, should cover props.

Missing still is the various on:* event handlers.

@bestguy
Copy link
Owner Author

bestguy commented Sep 8, 2019

Renaming issue to just cover missing events

@bestguy bestguy changed the title Spread props, events Spread event handlers Sep 8, 2019
@telemmaite
Copy link

@bestguy what do you recommend as a work around I have an input type search, after entering 3 letters I would like to run backend fetch. I was planning to use on:input and see if the string/query size is >= 3.
Maybe changing Input to input is enough

@bestguy
Copy link
Owner Author

bestguy commented Sep 13, 2019

Hi @telemmaite, I think I'll need to add support for the main events components use like on:click, on:input, etc. before Svelte supports on:*
I'll start a PR this weekend for components like Inputs and Buttons

@bestguy
Copy link
Owner Author

bestguy commented Sep 14, 2019

Hi @telemmaite , actually this should work:

<script>
  import { Input } from 'sveltestrap';
  let name = 'world';
</script>

<Input bind:value={name} />

<h1>Hi {name}!</h1>

You don't need to use on:input directly, although do plan to support passing event handlers.

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