MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / pollEvents

Method pollEvents

packages/bench/src/backends.ts:135–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 3

resolveFunction · 0.85
resizeZrevBatchFunction · 0.85
emptyZrevBatchFunction · 0.85

Tested by

no test coverage detected