1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Added pageAction to display the notifications.

This commit is contained in:
kkapsner 2017-06-29 07:21:36 +02:00
parent cba5680406
commit 5cec9781c2
10 changed files with 84 additions and 3 deletions

View file

@ -36,10 +36,21 @@
prefs
});
}
var port = browser.runtime.connect();
var tabId;
port.onMessage.addListener(function(data){
if (data.hasOwnProperty("tabId")){
console.log("my tab id is", data.tabId);
tabId = data.tabId;
}
});
var notifications = [];
function notify(data){
browser.runtime.sendMessage({"canvasBlocker-notify": data});
notifications.push(data);
port.postMessage({"canvasBlocker-notify": data});
}
const preferences = require("sdk/simple-prefs");
function prefs(name){
return preferences.prefs[name];
@ -99,5 +110,11 @@
if (data["canvasBlocker-unload"]){
enabled = false;
}
if (data["canvasBlocker-sendNotifications"] === tabId){
browser.runtime.sendMessage({
sender: tabId,
"canvasBlocker-notifications": notifications
});
}
});
}());