general.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Splide } from '../core/Splide/Splide';
  2. import { Components } from './components';
  3. import { Options } from './options';
  4. import { EventInterface } from './events';
  5. /**
  6. * The type for any function.
  7. *
  8. * @since 3.0.0
  9. */
  10. export type AnyFunction = ( ...args: any[] ) => any;
  11. /**
  12. * The type for a component.
  13. *
  14. * @since 3.0.0
  15. */
  16. export type ComponentConstructor<R extends BaseComponent = BaseComponent>
  17. = ( Splide: Splide, Components: Components, options: Options, event: EventInterface ) => R;
  18. /**
  19. * The interface for any component.
  20. *
  21. * @since 3.0.0
  22. */
  23. export interface BaseComponent {
  24. setup?(): void;
  25. mount?(): void;
  26. destroy?( completely?: boolean ): void;
  27. }
  28. /**
  29. * The interface for the Transition component.
  30. *
  31. * @since 3.0.0
  32. */
  33. export interface TransitionComponent extends BaseComponent {
  34. start( index: number, done: () => void ): void;
  35. cancel(): void;
  36. }
  37. /**
  38. * The interface for info of a splide instance to sync with.
  39. *
  40. * @since 3.2.8
  41. */
  42. export interface SyncTarget {
  43. splide: Splide;
  44. isParent?: boolean;
  45. }