Closed hardingjam closed 2 weeks ago
Unfortunately no, you'll have to use callback props to communicate back up. See this example: https://svelte.dev/repl/2f2d171a9ea7458191904cb2feb5a54c?version=3.38.2
I'm open to figuring out some way to handle events like this though, as that would be much more svelte-y.
Hey, started to use svelte-modals (thanks for creating this!), and while I think the callback method works fine, I think it would be possible to add event listeners by adding them to $on, in a similar same way as in this example: https://svelte.dev/repl/5b495a6d61e64d0cabdb3657f100837c?version=3.18.2
Not sure if it's possible to infer the types that way, though.
@daevid66 oh this is very interesting, I'll definitely take a look at this approach!
Svelte 5 now handles events with callback props, so nothing to do here.
Is it possible to dispatch events from a modal back to the component that called openModal()?
For example: