File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 1
1
import { axe } from "axe-core/axe.min.js" ;
2
- import logger from "./logger " ;
2
+ import report from "./reporter " ;
3
3
4
- export default function ( url , raiseError ) {
4
+ export default function ( ) {
5
5
window . axe . a11yCheck ( document , { } , ( results ) => {
6
- logger ( results , url , raiseError ) ;
6
+ report ( results ) ;
7
7
} ) ;
8
8
}
Original file line number Diff line number Diff line change 1
1
import auditor from "./auditor.js" ;
2
2
3
- const DEFAULT_URL = "https://accesslint-service-staging.herokuapp.com/api/v1/reports" ;
3
+ ( function ( ) {
4
+ var load = function ( ) {
5
+ window . removeEventListener ( "load" , load , false ) ;
6
+ auditor ( ) ;
7
+ } ;
4
8
5
- window . AccessLint = {
6
- audit ( { url = DEFAULT_URL , raiseError = false } ) {
7
- auditor ( url , raiseError ) ;
8
- } ,
9
- } ;
9
+ window . addEventListener ( "load" , load ) ;
10
+ } ) ( ) ;
Original file line number Diff line number Diff line change 1
1
import request from "browser-request" ;
2
2
3
- export default function ( message , url , raiseError ) {
3
+ const url = "https://accesslint-service-staging.herokuapp.com/api/v1/reports" ;
4
+
5
+ export default function ( message ) {
4
6
let violations = message . violations ;
5
7
6
- if ( raiseError && violations . length > 0 ) {
7
- console . error ( message ) ;
8
- throw new Error ( `AccessLintError: ${ violations . length } violations.` ) ;
9
- } else {
8
+ if ( violations . length > 0 ) {
10
9
request ( {
11
10
method : "POST" ,
12
11
url : url ,
13
12
json : message ,
14
13
} , function ( ) { } ) ;
14
+
15
+ console . error ( message ) ;
16
+ throw new Error ( `AccessLintError: ${ violations . length } violations.` ) ;
15
17
}
16
18
}
You can’t perform that action at this time.
0 commit comments