(value: T)
| 7 | private _deferred: Resolve<T> | undefined |
| 8 | |
| 9 | push(value: T) { |
| 10 | // if we are already waiting for next even, resolve next promise |
| 11 | if (this._deferred) { |
| 12 | this._deferred(value) |
| 13 | this._deferred = undefined |
| 14 | } else { |
| 15 | this._queue.push(value) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | nextEvent(): Promise<T> { |
| 20 | const event = this._queue.shift() |
no outgoing calls