ext: state-driven toolbar icon, restyled popup

This commit is contained in:
Stefano Zini
2026-11-05 17:16:46 +01:00
parent 23c0a18974
commit bc98e0d004
4 changed files with 63 additions and 6 deletions
+2
View File
@@ -4,6 +4,8 @@ const API = "http://127.0.0.1:18765";
let recorder, audioContext, tabStream, micStream, uploadQueue = Promise.resolve(), recordingName;
// state: idle | recording | transcribing | done | error ; popup polls it
const recorderState = { state: "idle", name: "", t0: 0, t1: 0, chunks: 0, mic: false, text: "" };
// Toolbar icon follows state; failed uploads while recording show as error. The idle icon is drawn by background.js on startup.
setInterval(() => chrome.runtime.sendMessage({ to: "bg", state: recorderState.state === "recording" && recorderState.failed ? "error" : recorderState.state }), 1000);
// Messages from popup.js / teams.js are addressed with to:"off"; other messages are ignored.
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {