()
| 133 | } |
| 134 | |
| 135 | pollEvents(): Promise<BackendEventBatch> { |
| 136 | if (this.stopped) { |
| 137 | // Block forever after stop — prevents frame loop from spinning |
| 138 | return new Promise<BackendEventBatch>(() => {}); |
| 139 | } |
| 140 | // First poll must deliver a resize event to initialize the app's viewport. |
| 141 | // Without it, tryRenderOnce() bails out because viewport is null. |
| 142 | if (this.needsResize) { |
| 143 | this.needsResize = false; |
| 144 | return new Promise<BackendEventBatch>((resolve) => { |
| 145 | setTimeout(() => resolve(resizeZrevBatch(this.cols, this.rows)), 0); |
| 146 | }); |
| 147 | } |
| 148 | // Subsequent polls yield empty batches after a short delay so the frame |
| 149 | // loop can render when state is dirty, without busy-spinning. |
| 150 | return new Promise<BackendEventBatch>((resolve) => { |
| 151 | setTimeout(() => resolve(emptyZrevBatch()), 0); |
| 152 | }); |
| 153 | } |
| 154 | |
| 155 | reset(): void { |
| 156 | this.frameCount = 0; |
nothing calls this directly
no test coverage detected