(obj, priority)
| 26 | } |
| 27 | |
| 28 | enqueue(obj, priority) { |
| 29 | // Convert to integer with a default value of 0. |
| 30 | priority = (priority && +priority | 0) || 0; |
| 31 | |
| 32 | if (priority) { |
| 33 | if (priority < 0 || priority >= this._size) { |
| 34 | priority = this._size - 1; |
| 35 | // put obj at the end of the line |
| 36 | } |
| 37 | } |
| 38 | this._slots[priority].push(obj); |
| 39 | } |
| 40 | |
| 41 | dequeue() { |
| 42 | for (let i = 0, sl = this._slots.length; i < sl; i += 1) { |