(data)
| 100 | } |
| 101 | |
| 102 | push(data) { |
| 103 | if (this.head.isFull()) { |
| 104 | // Head is full: Creates a new queue, sets the old queue's `.next` to it, |
| 105 | // and sets it as the new main queue. |
| 106 | this.head = this.head.next = FixedQueue.#pool.pop() ?? new FixedCircularBuffer(); |
| 107 | } |
| 108 | this.head.push(data); |
| 109 | } |
| 110 | |
| 111 | shift() { |
| 112 | const tail = this.tail; |
no test coverage detected