()
| 158 | } |
| 159 | |
| 160 | export async function getCommands(): Promise<chrome.commands.Command[]> { |
| 161 | return new Promise<chrome.commands.Command[]>((resolve) => { |
| 162 | if (!chrome.commands) { |
| 163 | resolve([]); |
| 164 | return; |
| 165 | } |
| 166 | chrome.commands.getAll((commands) => { |
| 167 | if (commands) { |
| 168 | resolve(commands); |
| 169 | } else { |
| 170 | resolve([]); |
| 171 | } |
| 172 | }); |
| 173 | }); |
| 174 | } |
| 175 | |
| 176 | export function keepListeningToEvents(): () => void { |
| 177 | let intervalId = 0; |