swiper-events.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. import { SwiperOptions } from './swiper-options';
  2. import Swiper from './swiper-class';
  3. import { A11yEvents } from './modules/a11y';
  4. import { AutoplayEvents } from './modules/autoplay';
  5. import { ControllerEvents } from './modules/controller';
  6. import { CoverflowEffectEvents } from './modules/effect-coverflow';
  7. import { CubeEffectEvents } from './modules/effect-cube';
  8. import { FadeEffectEvents } from './modules/effect-fade';
  9. import { FlipEffectEvents } from './modules/effect-flip';
  10. import { CreativeEffectEvents } from './modules/effect-creative';
  11. import { CardsEffectEvents } from './modules/effect-cards';
  12. import { HashNavigationEvents } from './modules/hash-navigation';
  13. import { HistoryEvents } from './modules/history';
  14. import { KeyboardEvents } from './modules/keyboard';
  15. import { LazyEvents } from './modules/lazy';
  16. import { MousewheelEvents } from './modules/mousewheel';
  17. import { NavigationEvents } from './modules/navigation';
  18. import { PaginationEvents } from './modules/pagination';
  19. import { ParallaxEvents } from './modules/parallax';
  20. import { ScrollbarEvents } from './modules/scrollbar';
  21. import { ThumbsEvents } from './modules/thumbs';
  22. import { VirtualEvents } from './modules/virtual';
  23. import { ZoomEvents } from './modules/zoom';
  24. import { FreeModeEvents } from './modules/free-mode';
  25. export interface SwiperEvents {
  26. // CORE_EVENTS_START
  27. /**
  28. * Fired right after Swiper initialization.
  29. * @note Note that with `swiper.on('init')` syntax it will
  30. * work only in case you set `init: false` parameter.
  31. *
  32. * @example
  33. * ```js
  34. * const swiper = new Swiper('.swiper', {
  35. * init: false,
  36. * // other parameters
  37. * });
  38. * swiper.on('init', function() {
  39. * // do something
  40. * });
  41. * // init Swiper
  42. * swiper.init();
  43. * ```
  44. *
  45. * @example
  46. * ```js
  47. * // Otherwise use it as the parameter:
  48. * const swiper = new Swiper('.swiper', {
  49. * // other parameters
  50. * on: {
  51. * init: function () {
  52. * // do something
  53. * },
  54. * }
  55. * });
  56. * ```
  57. */
  58. init: (swiper: Swiper) => any;
  59. /**
  60. * Event will be fired right before Swiper destroyed
  61. */
  62. beforeDestroy: (swiper: Swiper) => void;
  63. /**
  64. * Event will be fired when currently active slide is changed
  65. */
  66. slideChange: (swiper: Swiper) => void;
  67. /**
  68. * Event will be fired in the beginning of animation to other slide (next or previous).
  69. */
  70. slideChangeTransitionStart: (swiper: Swiper) => void;
  71. /**
  72. * Event will be fired after animation to other slide (next or previous).
  73. */
  74. slideChangeTransitionEnd: (swiper: Swiper) => void;
  75. /**
  76. * Same as "slideChangeTransitionStart" but for "forward" direction only
  77. */
  78. slideNextTransitionStart: (swiper: Swiper) => void;
  79. /**
  80. * Same as "slideChangeTransitionEnd" but for "forward" direction only
  81. */
  82. slideNextTransitionEnd: (swiper: Swiper) => void;
  83. /**
  84. * Same as "slideChangeTransitionStart" but for "backward" direction only
  85. */
  86. slidePrevTransitionStart: (swiper: Swiper) => void;
  87. /**
  88. * Same as "slideChangeTransitionEnd" but for "backward" direction only
  89. */
  90. slidePrevTransitionEnd: (swiper: Swiper) => void;
  91. /**
  92. * Event will be fired in the beginning of transition.
  93. */
  94. transitionStart: (swiper: Swiper) => void;
  95. /**
  96. * Event will be fired after transition.
  97. */
  98. transitionEnd: (swiper: Swiper) => void;
  99. /**
  100. * Event will be fired when user touch Swiper. Receives `touchstart` event as an arguments.
  101. */
  102. touchStart: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  103. /**
  104. * Event will be fired when user touch and move finger over Swiper. Receives `touchmove` event as an arguments.
  105. */
  106. touchMove: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  107. /**
  108. * Event will be fired when user touch and move finger over Swiper in direction opposite to direction parameter. Receives `touchmove` event as an arguments.
  109. */
  110. touchMoveOpposite: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  111. /**
  112. * Event will be fired when user touch and move finger over Swiper and move it. Receives `touchmove` event as an arguments.
  113. */
  114. sliderMove: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  115. /**
  116. * Event will be fired when user release Swiper. Receives `touchend` event as an arguments.
  117. */
  118. touchEnd: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  119. /**
  120. * Event will be fired when user click/tap on Swiper. Receives `touchend` event as an arguments.
  121. */
  122. click: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  123. /**
  124. * Event will be fired when user click/tap on Swiper. Receives `touchend` event as an arguments.
  125. */
  126. tap: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  127. /**
  128. * Event will be fired when user double tap on Swiper's container. Receives `touchend` event as an arguments
  129. */
  130. doubleTap: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  131. /**
  132. * Event will be fired right after all inner images are loaded. updateOnImagesReady should be also enabled
  133. */
  134. imagesReady: (swiper: Swiper) => void;
  135. /**
  136. * Event will be fired when Swiper progress is changed, as an arguments it receives progress that is always from 0 to 1
  137. */
  138. progress: (swiper: Swiper, progress: number) => void;
  139. /**
  140. * Event will be fired when Swiper reach its beginning (initial position)
  141. */
  142. reachBeginning: (swiper: Swiper) => void;
  143. /**
  144. * Event will be fired when Swiper reach last slide
  145. */
  146. reachEnd: (swiper: Swiper) => void;
  147. /**
  148. * Event will be fired when Swiper goes to beginning or end position
  149. */
  150. toEdge: (swiper: Swiper) => void;
  151. /**
  152. * Event will be fired when Swiper goes from beginning or end position
  153. */
  154. fromEdge: (swiper: Swiper) => void;
  155. /**
  156. * Event will be fired when swiper's wrapper change its position. Receives current translate value as an arguments
  157. */
  158. setTranslate: (swiper: Swiper, translate: number) => void;
  159. /**
  160. * Event will be fired everytime when swiper starts animation. Receives current transition duration (in ms) as an arguments
  161. */
  162. setTransition: (swiper: Swiper, transition: number) => void;
  163. /**
  164. * Event will be fired on window resize right before swiper's onresize manipulation
  165. */
  166. resize: (swiper: Swiper) => void;
  167. /**
  168. * Event will be fired if observer is enabled and it detects DOM mutations
  169. */
  170. observerUpdate: (swiper: Swiper) => void;
  171. /**
  172. * Event will be fired right before "loop fix"
  173. */
  174. beforeLoopFix: (swiper: Swiper) => void;
  175. /**
  176. * Event will be fired after "loop fix"
  177. */
  178. loopFix: (swiper: Swiper) => void;
  179. /**
  180. * Event will be fired on breakpoint change
  181. */
  182. breakpoint: (swiper: Swiper, breakpointParams: SwiperOptions) => void;
  183. /**
  184. * !INTERNAL: Event will fired right before breakpoint change
  185. */
  186. _beforeBreakpoint?: (swiper: Swiper, breakpointParams: SwiperOptions) => void;
  187. /**
  188. * !INTERNAL: Event will fired after setting CSS classes on swiper container element
  189. */
  190. _containerClasses?: (swiper: Swiper, classNames: string) => void;
  191. /**
  192. * !INTERNAL: Event will fired after setting CSS classes on swiper slide element
  193. */
  194. _slideClass?: (swiper: Swiper, slideEl: HTMLElement, classNames: string) => void;
  195. /**
  196. * !INTERNAL: Event will fired after setting CSS classes on all swiper slides
  197. */
  198. _slideClasses?: (
  199. swiper: Swiper,
  200. slides: { slideEl: HTMLElement; classNames: string; index: number }[],
  201. ) => void;
  202. /**
  203. * !INTERNAL: Event will fired as soon as swiper instance available (before init)
  204. */
  205. _swiper?: (swiper: Swiper) => void;
  206. /**
  207. * !INTERNAL: Event will be fired on free mode touch end (release) and there will no be momentum
  208. */
  209. _freeModeNoMomentumRelease?: (swiper: Swiper) => void;
  210. /**
  211. * Event will fired on active index change
  212. */
  213. activeIndexChange: (swiper: Swiper) => void;
  214. /**
  215. * Event will fired on snap index change
  216. */
  217. snapIndexChange: (swiper: Swiper) => void;
  218. /**
  219. * Event will fired on real index change
  220. */
  221. realIndexChange: (swiper: Swiper) => void;
  222. /**
  223. * Event will fired right after initialization
  224. */
  225. afterInit: (swiper: Swiper) => void;
  226. /**
  227. * Event will fired right before initialization
  228. */
  229. beforeInit: (swiper: Swiper) => void;
  230. /**
  231. * Event will fired before resize handler
  232. */
  233. beforeResize: (swiper: Swiper) => void;
  234. /**
  235. * Event will fired before slide change transition start
  236. */
  237. beforeSlideChangeStart: (swiper: Swiper) => void;
  238. /**
  239. * Event will fired before transition start
  240. */
  241. beforeTransitionStart: (swiper: Swiper, speed: number, internal: any) => void; // what is internal?
  242. /**
  243. * Event will fired on direction change
  244. */
  245. changeDirection: (swiper: Swiper) => void;
  246. /**
  247. * Event will be fired when user double click/tap on Swiper
  248. */
  249. doubleClick: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
  250. /**
  251. * Event will be fired on swiper destroy
  252. */
  253. destroy: (swiper: Swiper) => void;
  254. /**
  255. * Event will be fired on momentum bounce
  256. */
  257. momentumBounce: (swiper: Swiper) => void;
  258. /**
  259. * Event will be fired on orientation change (e.g. landscape -> portrait)
  260. */
  261. orientationchange: (swiper: Swiper) => void;
  262. /**
  263. * Event will be fired in the beginning of animation of resetting slide to current one
  264. */
  265. slideResetTransitionStart: (swiper: Swiper) => void;
  266. /**
  267. * Event will be fired in the end of animation of resetting slide to current one
  268. */
  269. slideResetTransitionEnd: (swiper: Swiper) => void;
  270. /**
  271. * Event will be fired with first touch/drag move
  272. */
  273. sliderFirstMove: (swiper: Swiper, event: TouchEvent) => void;
  274. /**
  275. * Event will be fired when number of slides has changed
  276. */
  277. slidesLengthChange: (swiper: Swiper) => void;
  278. /**
  279. * Event will be fired when slides grid has changed
  280. */
  281. slidesGridLengthChange: (swiper: Swiper) => void;
  282. /**
  283. * Event will be fired when snap grid has changed
  284. */
  285. snapGridLengthChange: (swiper: Swiper) => void;
  286. /**
  287. * Event will be fired after swiper.update() call
  288. */
  289. update: (swiper: Swiper) => void;
  290. /**
  291. * Event will be fired when swiper is locked (when `watchOverflow` enabled)
  292. */
  293. lock: (swiper: Swiper) => void;
  294. /**
  295. * Event will be fired when swiper is unlocked (when `watchOverflow` enabled)
  296. */
  297. unlock: (swiper: Swiper) => void;
  298. // CORE_EVENTS_END
  299. }
  300. interface SwiperEvents extends A11yEvents {}
  301. interface SwiperEvents extends AutoplayEvents {}
  302. interface SwiperEvents extends ControllerEvents {}
  303. interface SwiperEvents extends CoverflowEffectEvents {}
  304. interface SwiperEvents extends CubeEffectEvents {}
  305. interface SwiperEvents extends FadeEffectEvents {}
  306. interface SwiperEvents extends FlipEffectEvents {}
  307. interface SwiperEvents extends CreativeEffectEvents {}
  308. interface SwiperEvents extends CardsEffectEvents {}
  309. interface SwiperEvents extends HashNavigationEvents {}
  310. interface SwiperEvents extends HistoryEvents {}
  311. interface SwiperEvents extends KeyboardEvents {}
  312. interface SwiperEvents extends LazyEvents {}
  313. interface SwiperEvents extends MousewheelEvents {}
  314. interface SwiperEvents extends NavigationEvents {}
  315. interface SwiperEvents extends PaginationEvents {}
  316. interface SwiperEvents extends ParallaxEvents {}
  317. interface SwiperEvents extends ScrollbarEvents {}
  318. interface SwiperEvents extends ThumbsEvents {}
  319. interface SwiperEvents extends VirtualEvents {}
  320. interface SwiperEvents extends ZoomEvents {}
  321. interface SwiperEvents extends FreeModeEvents {}