[Feat]: Enhanced Event System with Context and Cancellable Events #1217
-
Which variants of Embla Carousel are relevant to this feature request?
Feature descriptionIntroduce a more powerful event system for Embla Carousel that provides rich event context and allows event cancellation through return values. Key Features:1. Rich Event Context type EmblaEventModelType<EventType> = {
api: EmblaCarouselType
type: EmblaEventType
detail: EmblaEventListType[EventType]
}2. Cancellable Events emblaApi.on('resize', (event) => {
// Custom resize handling
if (shouldPreventDefault) {
return false // Prevents core resize logic
}
})3. Event-Specific Details
Benefits:
This enables powerful customisations like custom resize handling, advanced focus management, and sophisticated plugin development while maintaining the simplicity of the existing API. Additional ContextThis enhancement builds upon the existing event system to provide:
Example Use Cases:
Before submitting
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Implemented in d7f875a. |
Beta Was this translation helpful? Give feedback.
Implemented in d7f875a.