From 1938dfb49093bf69b5081b0ea32cf11b38aa6079 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Wed, 18 Oct 2023 16:52:07 +0200 Subject: [PATCH 1/2] remove irrelevant reload --- Audio-Transcription-Chrome/background.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Audio-Transcription-Chrome/background.js b/Audio-Transcription-Chrome/background.js index 8f51b67e..f860209b 100644 --- a/Audio-Transcription-Chrome/background.js +++ b/Audio-Transcription-Chrome/background.js @@ -207,13 +207,3 @@ chrome.runtime.onMessage.addListener(async (message) => { }); -/** - * Listens for if the tab is reloaded. - * @param {Object} message - The message received from the runtime. - */ -chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { - if (changeInfo.status === 'complete') { - await executeScriptInTab(tabId, "content.js"); - await delayExecution(500); - } -}); From a2b5220738908053c22a5c5a7a8dcdfa95e68ba7 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Wed, 18 Oct 2023 16:52:47 +0200 Subject: [PATCH 2/2] send empty responses and remove async; its not helping --- Audio-Transcription-Chrome/content.js | 5 +++-- Audio-Transcription-Chrome/options.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Audio-Transcription-Chrome/content.js b/Audio-Transcription-Chrome/content.js index d1f2c6c9..1c89a2a8 100644 --- a/Audio-Transcription-Chrome/content.js +++ b/Audio-Transcription-Chrome/content.js @@ -173,13 +173,13 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { if (type === "STOP") { remove_element(); sendResponse({data: "STOPPED"}); - return; + return true; } else if (type === "showWaitPopup"){ initPopupElement(); showPopup(`Estimated wait time ~ ${Math.round(data)} minutes`); sendResponse({data: "popup"}); - return; + return true; } init_element(); @@ -234,4 +234,5 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { } sendResponse({}); + return true; }); diff --git a/Audio-Transcription-Chrome/options.js b/Audio-Transcription-Chrome/options.js index 756fe18d..af77b386 100644 --- a/Audio-Transcription-Chrome/options.js +++ b/Audio-Transcription-Chrome/options.js @@ -184,16 +184,17 @@ async function startRecord(option) { * @param {Object} sender - The sender object containing information about the message sender. * @param {Function} sendResponse - The function to send a response back to the message sender. */ -chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => { +chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { const { type, data } = request; switch (type) { case "start_capture": - await startRecord(data); + startRecord(data); break; default: break; } sendResponse({}); + return true; });