forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblazy.d.ts
72 lines (46 loc) · 1.52 KB
/
blazy.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
// Type definitions for bLazy v1.5.2
// Project: https://github.com/dinbror/blazy
// Definitions by: Julien Paroche <https://github.com/julienpa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/blazy
// Definitions based on: http://dinbror.dk/blog/blazy
declare var Blazy: Blazy;
interface Blazy {
new (options: BlazyOptions): BlazyInstance;
}
interface BlazyOptions {
breakpoints?: Breakpoint[];
container?: string;
error?: (ele: Element|HTMLElement, msg: string) => void;
errorClass?: string;
loadInvisible?: boolean;
offset?: number;
saveViewportOffsetDelay?: number;
selector?: string;
separator?: string;
src?: string;
success?: (ele: Element|HTMLElement) => void;
successClass?: string;
validateDelay?: number;
}
interface BlazyInstance {
/**
* Revalidates document for visible images. Useful if you add images with scripting or ajax.
*/
revalidate(): void;
/**
* Forces the given element(s) to load if not collapsed. If you also want to load a collapsed/hidden elements you can add true as the second parameter.
* You can pass a single element or a list of elements. Tested with getElementById, getElementsByClassName, querySelectorAll, querySelector and jQuery selector.
*/
load(elements: Element|Element[]|HTMLElement|HTMLElement[]|NodeList, force: boolean): void;
/**
* Unbind events and resets image array.
*/
destroy(): void;
}
interface Breakpoint {
width: number;
src: string;
}
declare module 'Blazy' {
export = Blazy;
}