Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chrome extension errors in the options tab #58

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Audio-Transcription-Chrome/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
5 changes: 3 additions & 2 deletions Audio-Transcription-Chrome/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -234,4 +234,5 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
}

sendResponse({});
return true;
});
5 changes: 3 additions & 2 deletions Audio-Transcription-Chrome/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Loading