From 88dea3ef0ad9ca4017d2fdf58cdce13686dfbd57 Mon Sep 17 00:00:00 2001 From: mic <m@micz.it> Date: Mon, 30 Dec 2024 11:04:56 +0100 Subject: [PATCH] first listener added. see micz/thunderai#182 --- mztas-background.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mztas-background.js b/mztas-background.js index 087d6c9..4442b04 100644 --- a/mztas-background.js +++ b/mztas-background.js @@ -16,6 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +// ============== FOR TESTING ============== browser.browserAction.onClicked.addListener(() => { testThunderAISparks(); }); @@ -32,4 +33,21 @@ browser.messageDisplayAction.onClicked.addListener(() => { summary: "ThunderAI Sparks", forceAllDay: false }); - } \ No newline at end of file + } +// ========================================= + +// Listen for messages +browser.runtime.onMessage.addListener((message, sender, sendResponse) => { + console.log("Message received:", message); + console.log("Sender info:", sender); + + sendResponse({ response: "Message received successfully!" }); + + switch (message.action) { + case "openCalendarDialog": + browser.CalendarTools.openCalendarDialog(message.data); + break; + } + + return true; +}); \ No newline at end of file