index.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import type { App } from 'vue';
  2. declare type ListenEvent =
  3. | 'scroll'
  4. | 'wheel'
  5. | 'mousewheel'
  6. | 'resize'
  7. | 'animationend'
  8. | 'transitionend'
  9. | 'touchmove';
  10. // eslint-disable-next-line
  11. declare type Callback = (listener: any, options: LazyloadOptions) => void;
  12. declare type Filter = {
  13. webp?: Callback;
  14. progressive?: Callback;
  15. };
  16. declare type Adapter = {
  17. error?: Callback;
  18. loaded?: Callback;
  19. loading?: Callback;
  20. };
  21. export declare type LazyloadOptions = {
  22. error?: string;
  23. filter?: Filter;
  24. silent?: boolean;
  25. adapter?: Adapter;
  26. loading?: string;
  27. attempt?: number;
  28. preLoad?: number;
  29. observer?: boolean;
  30. lazyImage?: boolean;
  31. throttleWait?: number;
  32. listenEvents?: ListenEvent[];
  33. dispatchEvent?: boolean;
  34. lazyComponent?: boolean;
  35. observerOptions?: IntersectionObserverInit;
  36. };
  37. export declare const Lazyload: {
  38. install(app: App, options?: LazyloadOptions): void;
  39. };
  40. declare module '@vue/runtime-core' {
  41. interface ComponentCustomProperties {
  42. $Lazyload: {
  43. $on: (event: string, handler: Callback) => void;
  44. $off: (event: string, handler?: Callback) => void;
  45. $once: (event: string, handler: Callback) => void;
  46. };
  47. }
  48. }