(source, tabId)
| 384 | } |
| 385 | |
| 386 | function flushCommand(source, tabId) { |
| 387 | const pending = pendingCommands.get(source); |
| 388 | if (pending) { |
| 389 | clearTimeout(pending.timer); |
| 390 | pendingCommands.delete(source); |
| 391 | sendTabMessageWithTimeout(tabId, source, pending.message).then(pending.resolve).catch(pending.reject); |
| 392 | console.log(LOG_PREFIX, `Flushed queued command to ${source} (tab ${tabId})`); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | function cancelPendingCommands(reason = STOP_ERROR_MESSAGE) { |
| 397 | for (const [source, pending] of pendingCommands.entries()) { |
no test coverage detected