1
1
import axeCore from 'axe-core'
2
2
import debounce from 'lodash.debounce'
3
3
import merge from 'lodash.merge'
4
- import { checkAndReport , resetCache , resetLastNotification } from './utils'
4
+ import { checkAndReport , draf , resetCache , resetLastNotification } from './utils'
5
5
6
6
export default function install ( Vue , options ) {
7
7
// Browser only
@@ -44,20 +44,18 @@ export default function install (Vue, options) {
44
44
Vue . prototype . $axe = {
45
45
run ( { clearConsole = options . clearConsoleOnUpdate , element = document } = { } ) {
46
46
this . clearConsole ( clearConsole )
47
- if ( ! clearConsole ) resetLastNotification ( )
48
- Vue . nextTick ( ) . then ( ( ) => checkAndReport ( options , element ) )
47
+ draf ( ( ) => checkAndReport ( options , element ) )
49
48
} ,
50
49
plugins : axeCore . plugins ,
51
50
clearConsole ( forceClear = false ) {
52
51
resetCache ( )
53
-
54
52
if ( forceClear || options . clearConsoleOnUpdate ) {
55
53
console . clear ( )
56
54
resetLastNotification ( )
57
55
}
58
56
} ,
59
57
debounce : debounce ( function ( ) {
60
- this . run ( { clearConsole : options . clearConsoleOnUpdate } )
58
+ this . run ( )
61
59
} , 1000 , { maxWait : 5000 } )
62
60
}
63
61
@@ -75,5 +73,5 @@ export default function install (Vue, options) {
75
73
}
76
74
} )
77
75
78
- setTimeout ( ( ) => Vue . nextTick ( ) . then ( ( ) => checkAndReport ( options , document ) ) , options . delay )
76
+ setTimeout ( ( ) => draf ( ( ) => checkAndReport ( options , document ) ) , options . delay )
79
77
}
0 commit comments