()
| 99 | } |
| 100 | |
| 101 | function setDisconnected() { |
| 102 | const wasConnected = isConnected; |
| 103 | isConnected = false; |
| 104 | // Keep authToken — it persists across reconnections |
| 105 | chrome.action.setBadgeText({ text: '' }); |
| 106 | |
| 107 | chrome.runtime.sendMessage({ type: 'health', data: null }).catch((err) => { |
| 108 | console.debug('[gstack bg] No listener for disconnect broadcast:', err.message); |
| 109 | }); |
| 110 | |
| 111 | // Notify content scripts on disconnection |
| 112 | if (wasConnected) { |
| 113 | notifyContentScripts('disconnected'); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | async function notifyContentScripts(type) { |
| 118 | try { |
no test coverage detected