fix: batch clear all notifs to prevent blocking
This commit is contained in:
parent
b83ac6e50a
commit
5b153fde8f
1 changed files with 14 additions and 4 deletions
|
|
@ -149,14 +149,24 @@ Item {
|
|||
id: clearTimer
|
||||
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
interval: Math.max(15, Math.min(80, 69.8 - 12.3 * Math.log(Notifs.notClosed.length)))
|
||||
onTriggered: {
|
||||
const first = Notifs.notClosed[0];
|
||||
if (first) {
|
||||
for (const n of Notifs.notClosed.filter(n => n.appName === first.appName))
|
||||
n.close();
|
||||
} else {
|
||||
if (!first) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
const appName = first.appName;
|
||||
let cleared = 0;
|
||||
for (const n of Notifs.notClosed.filter(n => n.appName === appName)) {
|
||||
n.close();
|
||||
cleared++;
|
||||
if (cleared > 30) {
|
||||
interval = 5;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue