1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-06-05 12:57:50 +02:00

Send only necessary notifications to main process

For #238
This commit is contained in:
kkapsner 2018-09-16 12:15:04 +02:00
parent db79c0129b
commit e4c2196131

View File

@ -69,13 +69,17 @@
});
var notifications = [];
var notificationCounter = {};
var sentAPIs = {};
function notify(data){
if (!settings.ignoredAPIs[data.api]){
if (settings.storeNotificationData){
notifications.push(data);
}
notificationCounter[data.messageId] = (notificationCounter[data.messageId] || 0) + 1;
port.postMessage({"canvasBlocker-notify": data});
if (!sentAPIs[data.api]){
sentAPIs[data.api] = true;
port.postMessage({"canvasBlocker-notify": data});
}
}
}