From 96be5a4418c3d08a86df4cfb26e69f59b65b6e3c Mon Sep 17 00:00:00 2001 From: ccppi Date: Mon, 18 Mar 2024 11:39:52 +0100 Subject: [PATCH] sdf --- background.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index e59e51a..1b95131 100644 --- a/background.js +++ b/background.js @@ -8,7 +8,9 @@ readUrl(); function Setup(data) { let i=0; - browser.browserAction.onClicked.addListener(create); + browser.browserAction.onClicked.addListener(function(event){ + create(data); + }); } var create = (function(data){ @@ -17,11 +19,16 @@ var create = (function(data){ browser.runtime.onMessage.addListener((message)=>{ if(message === "Button_clicked") { - nextUrl(data,tab,i); + console.log("pass tab data to run, in promise"); console.log(tab); } + else if(message === "Content_Loaded") + { + console.log("Received Content_Loaded"); + nextUrl(data,tab,i); + } }); }); }); @@ -38,6 +45,7 @@ async function nextUrl(data,tab,i) code1 = `window.location.replace("${data.subscriptions[i].url}");` console.log(code1); await browser.tabs.update(tab.tabid,{url : data.subscriptions[i].url}); + await waitforTab(tab,data.subscriptions[i].url); console.log(tab); console.log("iterating"); console.log(i);