@@ -36,33 +36,33 @@ export default function install (Vue, options) {
36
36
37
37
options = merge ( defaultOptions , options )
38
38
39
- // Configure the format data
40
39
axeCore . configure ( { ...options . config } )
41
40
42
- // Rechecking when updating specific component
41
+ Vue . prototype . $axe = {
42
+ run ( { clearConsole = true , element = document } = { } ) {
43
+ this . clearConsole ( clearConsole )
44
+ if ( ! clearConsole ) resetLastNotification ( )
45
+ Vue . nextTick ( ) . then ( ( ) => checkAndReport ( options , element ) )
46
+ } ,
47
+ clearConsole ( forceClear = false ) {
48
+ resetCache ( )
49
+
50
+ if ( forceClear || options . clearConsoleOnUpdate ) {
51
+ console . clear ( )
52
+ resetLastNotification ( )
53
+ }
54
+ } ,
55
+ debounce : debounce ( function ( ) {
56
+ this . run ( { clearConsole : options . clearConsoleOnUpdate } )
57
+ } , 1000 , { maxWait : 5000 } )
58
+ }
59
+
43
60
Vue . mixin ( {
44
61
updated ( ) {
45
- this . debounceAxe ( )
62
+ this . $axe . debounce ( )
46
63
} ,
47
64
beforeDestroy ( ) {
48
- this . clearAxeConsole ( true )
49
- } ,
50
- methods : {
51
- clearAxeConsole ( forceClear = false ) {
52
- resetCache ( )
53
-
54
- if ( forceClear || options . clearConsoleOnUpdate ) {
55
- console . clear ( )
56
- resetLastNotification ( )
57
- }
58
- } ,
59
- axeRun ( { clearConsole = false , element = document } = { } ) {
60
- this . clearAxeConsole ( clearConsole )
61
- this . $nextTick ( ( ) => checkAndReport ( options , element ) )
62
- } ,
63
- debounceAxe : debounce ( function ( ) {
64
- this . axeRun ( )
65
- } , 1000 , { maxWait : 5000 } )
65
+ this . $axe . clearConsole ( true )
66
66
}
67
67
} )
68
68
0 commit comments