-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.d.ts
90 lines (74 loc) · 2.33 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Type definitions for OdoResponsiveImages
// Project: odopod-code-library
// Definitions by: Glen Cheney <https://github.com/Vestride>
export as namespace OdoResponsiveImages;
declare const instance: OdoResponsiveImages;
export = instance;
interface ImageItem {
id: string;
element: HTMLElement;
}
declare class OdoResponsiveImages {
constructor();
/**
* Class names used by this component.
*/
ClassName: {
IMAGE: string;
LOADED: string;
};
/**
* An array of viewport item ids and picture elements.
*/
images: ImageItem[];
/**
* Notify the Viewport to update its value. This method is called when a new
* image loads. It should also be called manually if offsets on the page change.
*/
updateOffsets(): void;
/**
* Add all OdoResponsiveImages currently on the page to the watched items.
*/
initialize(): void;
/**
* Whether an image element has already been loaded.
* @param {HTMLImageElement} img The <img>.
* @return {boolean}
*/
isImageLoaded(img: HTMLImageElement): boolean;
/**
* Whether the given element is already in the `images` object array.
* @param {Element} placeholder Element to test.
* @return {boolean}
*/
isUntrackedImage(placeholder: HTMLElement): boolean;
/**
* Clean up all references and listeners for current images.
*/
flush(): void;
/**
* Remove watched images from this component.
* @param {HTMLElement|HTMLElement[]} placeholders An element or array of elements.
* The element should be the parent element of the <img>.
*/
remove(placeholders: HTMLElement | HTMLElement[]): void;
/**
* Add more images for the ResponsiveImages component to watch.
* @param {HTMLElement|HTMLElement[]} pictures An element or array of elements.
* The element should be the parent element of the <img>.
*/
add(pictures: HTMLElement | HTMLElement[]): void;
/**
* Force the load of an element or group of elements instead of waiting for it
* to come into the viewport.
* @param {HTMLElement|HTMLElement[]} pictures An element or array of elements.
* The element should be the parent element of the <img>.
*/
load(pictures: HTMLElement | HTMLElement[]): void;
}
declare namespace OdoResponsiveImages {
/**
* Time in milliseconds that updates are debounced for.
*/
const DEBOUNCE_TIME: number;
}