@@ -12,6 +12,8 @@ declare module axe {
12
12
13
13
type RunOnlyType = "rule" | "rules" | "tag" | "tags" ;
14
14
15
+ type RunCallback = ( error : Error , results :AxeResults ) => void ;
16
+
15
17
interface ElementContext {
16
18
node ?: Object ,
17
19
selector ?: string ,
@@ -26,6 +28,13 @@ declare module axe {
26
28
}
27
29
values ?: TagValue [ ]
28
30
}
31
+ interface RunOptions {
32
+ runOnly ?: RunOnly ,
33
+ rules ?: Object ,
34
+ iframes ?: Boolean ,
35
+ elementRef ?: Boolean ,
36
+ selectors ?: Boolean
37
+ }
29
38
interface AxeResults {
30
39
url : string ,
31
40
timestamp : string ,
@@ -117,12 +126,18 @@ declare module axe {
117
126
/**
118
127
* Runs a number of rules against the provided HTML page and returns the resulting issue list
119
128
*
120
- * @param { Object } context Optional The `Context` specification object @see Context
121
- * @param { Array } options Optional Options passed into rules or checks, temporarily modifying them.
122
- * @param { Function } callback Optional The function to invoke when analysis is complete.
123
- * @returns {any } results If the callback was not defined, aXe will return a Promise instead .
129
+ * @param { ElementContext } context Optional The `Context` specification object @see Context
130
+ * @param { RunOptions } options Optional Options passed into rules or checks, temporarily modifying them.
131
+ * @param { RunCallback } callback Optional The function to invoke when analysis is complete.
132
+ * @returns {Promise<AxeResults>|void } If the callback was not defined, aXe will return a Promise.
124
133
*/
125
- function run ( context ?: ElementContext , options ?: { runOnly ?: RunOnly , rules ?: Object , iframes ?: Boolean , elementRef ?: Boolean , selectors ?: Boolean } , callback ?: ( error : Error , results :AxeResults ) => void ) : any
134
+ function run ( context : ElementContext ) : Promise < AxeResults >
135
+ function run ( options : RunOptions ) : Promise < AxeResults >
136
+ function run ( callback : ( error : Error , results :AxeResults ) => void ) : void
137
+ function run ( context : ElementContext , callback : RunCallback ) : void
138
+ function run ( options : RunOptions , callback : RunCallback ) : void
139
+ function run ( context : ElementContext , options : RunOptions ) : Promise < AxeResults >
140
+ function run ( context : ElementContext , options : RunOptions , callback : RunCallback ) : void
126
141
127
142
/**
128
143
* Starts analysis on the current document and its subframes
0 commit comments