(idOrRun: string | RunFunction)
| 61 | remove(id: string): void; |
| 62 | remove(run: RunFunction): void; |
| 63 | remove(idOrRun: string | RunFunction): void { |
| 64 | const index = this.#queue.findIndex((element: Readonly<PriorityQueueOptions & {run: RunFunction}>, index) => { |
| 65 | // The consumed prefix may still contain references that should not be removable. |
| 66 | if (index < this.#head) { |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | if (typeof idOrRun === 'string') { |
| 71 | return element.id === idOrRun; |
| 72 | } |
| 73 | |
| 74 | return element.run === idOrRun; |
| 75 | }); |
| 76 | |
| 77 | if (index !== -1) { |
| 78 | this.#queue.splice(index, 1); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | dequeue(): RunFunction | undefined { |
| 83 | if (this.#head === this.#queue.length) { |
no outgoing calls
no test coverage detected