forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagesloaded.d.ts
53 lines (41 loc) · 1.57 KB
/
imagesloaded.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
// Type definitions for imagesLoaded 3.1.8+
// Project: https://github.com/desandro/imagesloaded
// Definitions by: Chris Charabaruk <https://github.com/coldacid>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../jquery/jquery.d.ts" />
declare module ImagesLoaded {
type ElementSelector = Element | NodeList | Array<Element> | string;
/** interface for an image currently loading or completed */
interface LoadingImage {
img: HTMLImageElement;
isLoaded: boolean;
}
interface ImagesLoadedCallback {
(instance?: ImagesLoaded): void;
}
interface ImagesLoadedListener {
(instance: ImagesLoaded, image?: LoadingImage): void;
}
interface ImagesLoaded {
new (elem: ElementSelector, callback: ImagesLoadedCallback): ImagesLoaded;
images: Array<LoadingImage>;
// event listeners
on(event: string, listener: ImagesLoadedListener): void;
off(event: string, listener: ImagesLoadedListener): void;
}
interface ImagesLoadedConstructor {
/**
* Creates a new ImagesLoaded object with the provided callback
* @param elem Element, NodeList, Element array, or selector string for images to watch
* @param callback function triggered after all images have been loaded
*/
(elem: ElementSelector, callback?: ImagesLoadedCallback): ImagesLoaded;
}
}
declare var imagesLoaded: ImagesLoaded.ImagesLoadedConstructor;
declare module 'imagesloaded' {
export = imagesLoaded;
}
interface JQuery {
imagesLoaded(callback?: ImagesLoaded.ImagesLoadedCallback): JQueryDeferred<ImagesLoaded.ImagesLoaded>;
}