(commandsToRemove: QueuedCommand[])
| 273 | * (e.g. from getCommandsByMaxPriority). Logs a 'remove' operation for each. |
| 274 | */ |
| 275 | export function remove(commandsToRemove: QueuedCommand[]): void { |
| 276 | if (commandsToRemove.length === 0) { |
| 277 | return |
| 278 | } |
| 279 | |
| 280 | const before = commandQueue.length |
| 281 | for (let i = commandQueue.length - 1; i >= 0; i--) { |
| 282 | if (commandsToRemove.includes(commandQueue[i]!)) { |
| 283 | commandQueue.splice(i, 1) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | if (commandQueue.length !== before) { |
| 288 | notifySubscribers() |
| 289 | } |
| 290 | |
| 291 | for (const _cmd of commandsToRemove) { |
| 292 | logOperation('remove') |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Remove commands matching a predicate. |
nothing calls this directly
no test coverage detected