Skip to content

Latest commit

 

History

History
187 lines (110 loc) · 2.84 KB

File metadata and controls

187 lines (110 loc) · 2.84 KB

tinky


tinky / RenderOptions

Interface: RenderOptions

Options for the render function.

Properties

debug?

optional debug?: boolean

If true, each update will be rendered as separate output, without replacing.

Default Value

false;

env?

optional env?: Record<string, string | undefined>

Environment variables.

Default Value

process.env;

exitOnCtrlC?

optional exitOnCtrlC?: boolean

Configure whether Tinky should listen for Ctrl+C keyboard input and exit. This is needed in raw mode, where Ctrl+C is ignored by default.

Default Value

true;

incrementalRendering?

optional incrementalRendering?: IncrementalRenderingOption

Configure incremental rendering mode.

  • true: Enables run-diff incremental rendering.
  • false or omitted: Disables incremental rendering.
  • Object mode:
    • { enabled: false } disables incremental rendering.
    • { strategy: "line" } enables line-diff incremental rendering.
    • { strategy: "run" } (or omitted strategy) enables run-diff rendering.

Runtime notes:

  • In run strategy, terminal writes are skipped entirely when frames are unchanged.
  • In debug mode, Tinky always writes full frames.
  • In screen-reader mode, Tinky uses the screen-reader output path.
  • In CI mode, Tinky avoids cursor-diff updates.

Default Value

false;

isScreenReaderEnabled?

optional isScreenReaderEnabled?: boolean

Enable screen reader support.

Default Value

process.env["TINKY_SCREEN_READER"] === "true";

maxFps?

optional maxFps?: number

Maximum frames per second for render updates. Controls how frequently UI can update to prevent excessive re-rendering. Higher values allow more frequent updates but may impact performance.

Default Value

30;

onRender?

optional onRender?: (metrics) => void

runs the given callback after each render and re-render.

Parameters

metrics

RenderMetrics

Performance metrics of the render.

Returns

void


patchConsole?

optional patchConsole?: boolean

Patch console methods to ensure console output doesn't mix with Tinky's.

Default Value

true;

stderr?

optional stderr?: WriteStream

Error stream.

Default Value

process.stderr;

stdin?

optional stdin?: ReadStream

Input stream where the app will listen for input.

Default Value

process.stdin;

stdout?

optional stdout?: WriteStream

Output stream where the app will be rendered.

Default Value

process.stdout;