forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eq.js.d.ts
67 lines (53 loc) · 1.46 KB
/
eq.js.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
// Type definitions for eq.js
// Project: https://github.com/Snugug/eq.js
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var eqjs: eq.EqjsStatic;
// Support AMD require
declare module 'eqjs' {
export = eqjs;
}
declare namespace eq {
type AvailableElementType = HTMLElement|HTMLElement[]|NodeList|JQuery;
interface EqjsStatic {
/**
* List of all nodes.
*/
nodes: EqjsNodesTable;
/**
* Number of nodes in eqjs.nodes.
*/
nodesLength: number;
/**
* Runs through all nodes and finds their widths and points
* @param nodes
* @param callback function to use as a callback once query and nodeWrites have finished
*/
query(nodes: AvailableElementType, callback?: Function): void;
/**
* Refreshes the list of nodes for eqjs to work with
*/
refreshNodes(): void;
/**
* Sorts a simple object (key: value) by value and returns a sorted object.
* @param obj e.g. "small: 380, medium: 490, large: 600"
* @returns {}
*/
sortObj(obj: string): EqjsKeyValuePair[];
/**
* Runs through all nodes and writes their eq status.
* @param nodes An array or NodeList of nodes to query
* @returns {}
*/
nodeWrites(nodes?: AvailableElementType): void;
}
interface EqjsKeyValuePair {
key: string;
value: number;
}
interface EqjsNodesTable {
[index: number]: HTMLElement;
}
}
// Support jQuery selectors.
interface JQuery { }