Skip to content

Commit 7e76eec

Browse files
committed
do not clear console when nothing has changed
1 parent 0d44740 commit 7e76eec

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ export default function install (Vue, options) {
1818
// Rechecking when updating specific component
1919
Vue.mixin({
2020
methods: {
21-
clearAxeConsole () {
21+
clearAxeConsole (forceClear = false) {
2222
resetCache()
2323

24-
if (options.clearConsoleOnUpdate) {
24+
if (forceClear && options.clearConsoleOnUpdate) {
2525
console.clear()
2626
}
2727
},
2828
debounceAxe: debounce(function () {
2929
this.clearAxeConsole()
3030

3131
this.$nextTick(() => {
32-
checkAndReport(this.$el)
32+
checkAndReport(options, this.$el)
3333
})
3434
}, 2000, { maxWait: 6000 })
3535
},
@@ -38,9 +38,9 @@ export default function install (Vue, options) {
3838
},
3939
// Used for change of route
4040
beforeDestroy () {
41-
this.clearAxeConsole()
41+
this.clearAxeConsole(true)
4242
}
4343
})
4444

45-
return Vue.nextTick().then(() => checkAndReport(document))
45+
return Vue.nextTick().then(() => checkAndReport(options, document))
4646
}

src/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let nodes = []
99
let deferred = {}
1010
let lastNotification = ''
1111

12-
export function checkAndReport (node) {
12+
export function checkAndReport (options, node) {
1313
nodes.push(node)
1414
let deferred = createDeferred()
1515

@@ -18,6 +18,10 @@ export function checkAndReport (node) {
1818
if (!results) return
1919
if (JSON.stringify(results.violations) === lastNotification) return
2020

21+
if (options.clearConsoleOnUpdate) {
22+
console.clear()
23+
}
24+
2125
results.violations = results.violations.filter(result => {
2226
result.nodes = result.nodes.filter(node => {
2327
let key = node.target.toString() + result.id

0 commit comments

Comments
 (0)