[Help]: Simple Sveltekit + Typescript question #944
-
Summary
If applicable, which variants of Embla Carousel are relevant to this question?
Additional informationNo response CodeSandbox exampleNo response |
Beta Was this translation helpful? Give feedback.
Answered by
davidjerleke
Jul 18, 2024
Replies: 1 comment 1 reply
-
Hi @theRolento and thanks for your question. The type can be found here, so this should do it: <script>
import emblaCarouselSvelte from 'embla-carousel-svelte'
import { EmblaCarouselType } from 'embla-carousel'
let emblaApi: EmblaCarouselType
function onInit(event: CustomEvent<EmblaCarouselType>) {
emblaApi = event.detail
console.log(emblaApi.slideNodes()) // Access API
}
</script>
<div
class="embla"
use:emblaCarouselSvelte
on:emblaInit="{onInit}"
>
<div class="embla__container">
<div class="embla__slide">Slide 1</div>
<div class="embla__slide">Slide 2</div>
<div class="embla__slide">Slide 3</div>
</div>
</div> Let me know if it’s what you’re looking for. As you mentioned the type is missing here in the docs. Feel free to submit a PR that adds the missing type. Best, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
theRolento
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @theRolento and thanks for your question.
The type can be found here, so this should do it:
Let me know if it’s what you’re loo…