MCPcopy
hub / github.com/nolimits4web/swiper / on

Function on

src/core/events-emitter.ts:9–24  ·  view source on GitHub ↗
(
    this: Swiper,
    events: keyof SwiperEvents | string,
    handler: SwiperEventHandler,
    priority?: boolean,
  )

Source from the content-addressed store, hash-verified

7
8export default {
9 on(
10 this: Swiper,
11 events: keyof SwiperEvents | string,
12 handler: SwiperEventHandler,
13 priority?: boolean,
14 ): Swiper {
15 const self = this;
16 if (!self.eventsListeners || self.destroyed) return self;
17 if (typeof handler !== 'function') return self;
18 const method: 'unshift' | 'push' = priority ? 'unshift' : 'push';
19 (events as string).split(' ').forEach((event) => {
20 if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
21 self.eventsListeners[event]![method](handler);
22 });
23 return self;
24 },
25
26 once(
27 this: Swiper,

Callers 15

ControllerFunction · 0.85
MousewheelFunction · 0.85
A11yFunction · 0.85
GridFunction · 0.85
PaginationFunction · 0.85
ParallaxFunction · 0.85
AutoplayFunction · 0.85
ThumbFunction · 0.85
NavigationFunction · 0.85
VirtualFunction · 0.85
ScrollbarFunction · 0.85
HistoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected