Files
WhisperLive/Audio-Transcription-Firefox/background.js
T
2023-07-28 13:49:16 +05:30

14 lines
462 B
JavaScript

browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
const { action, data } = request;
if (action === "transcript") {
browser.tabs.query({ active: true, currentWindow: true })
.then((tabs) => {
const tabId = tabs[0].id;
browser.tabs.sendMessage(tabId, { action: "show_transcript", data });
})
.catch((error) => {
console.error("Error retrieving active tab:", error);
});
}
});