feat: add patchConsole, waitUntilRenderFlush, onRender, and maxFps
Add four behavioral surfaces to the runtime:
- patchConsole (default: true): intercepts console.* methods to route
output through writeToStdout/writeToStderr, preventing frame corruption.
Disabled in debug mode. Restored before Vue cleanup on teardown.
- waitUntilRenderFlush(): flushes pending throttled renders and waits
for the stdout write barrier, exposed on TuiApp and testing RenderResult.
- onRender callback: fires after each commit with { renderTime } in ms.
- maxFps option: overrides the scheduler's default 32ms throttle interval
with 1000/maxFps. The scheduler now accepts a throttleMs option and
exposes hasPending() for flush coordination.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ export interface RenderResult {
|
||||
terminal: Terminal;
|
||||
unmount(this: void): void;
|
||||
waitUntilExit(this: void): Promise<unknown>;
|
||||
waitUntilRenderFlush(this: void): Promise<void>;
|
||||
}
|
||||
|
||||
function trimFrame(raw: string): string {
|
||||
@@ -132,5 +133,6 @@ export async function render(
|
||||
terminal,
|
||||
unmount: app.unmount.bind(app),
|
||||
waitUntilExit: app.waitUntilExit.bind(app),
|
||||
waitUntilRenderFlush: app.waitUntilRenderFlush.bind(app),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user