UNPKG

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