Fix: Add debounce to favicon update (#3442)

This commit is contained in:
Nelson Chan 2023-08-01 15:12:17 +08:00 committed by GitHub
parent 587d9e4781
commit 09c6798a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,8 @@ export default {
message: "",
errorMessage: "",
currentPassword: "",
}
},
faviconUpdateDebounce: null,
};
},
@ -760,7 +761,12 @@ export default {
// Update Badge
"stats.down"(to, from) {
if (to !== from) {
favicon.badge(to);
if (this.faviconUpdateDebounce != null) {
clearTimeout(this.faviconUpdateDebounce);
}
this.faviconUpdateDebounce = setTimeout(() => {
favicon.badge(to);
}, 1000);
}
},