API reference
flagstaff/log-update
Every export of flagstaff/log-update, with its signature and doc comment: createLogUpdate, logUpdateStderr, logUpdate, plus 4 types.
import logUpdate from 'flagstaff/log-update';
import { createLogUpdate, logUpdateStderr } from 'flagstaff/log-update';Functions
createLogUpdate
A renderer bound to one stream. logUpdate is this over the runtime's stdout.
function createLogUpdate(stream: LogUpdateStream, { showCursor: keepCursor, defaultWidth, defaultHeight }?: LogUpdateOptions): LogUpdate;| Parameter | Type |
|---|---|
stream | LogUpdateStream |
{ showCursor: keepCursor, defaultWidth, defaultHeight } (optional) | LogUpdateOptions |
Returns LogUpdate
Constants
default
The default export, declared as logUpdate.
const logUpdate: LogUpdate;logUpdateStderr
const logUpdateStderr: LogUpdate;Interfaces
LogUpdate
interface LogUpdate {
(...text: unknown[]): void;
/** Erase the current frame, leaving nothing behind. */
clear(): void;
/** Give up the rows: the frame stays on screen and the next render starts fresh. */
done(): void;
/** Replace the frame with text that stays, unclipped, and start fresh after it. */
persist(...text: unknown[]): void;
}LogUpdateOptions
interface LogUpdateOptions {
/** Leave the cursor visible while a frame is up. Default false. */
showCursor?: boolean;
/** Columns to assume when the stream reports none. Default 80. */
defaultWidth?: number;
/** Rows to assume when the stream reports none. Default 24. */
defaultHeight?: number;
}LogUpdateStream
What log-update writes to: the runtime's stdout by default, anything stream-shaped in a test.
interface LogUpdateStream {
write(chunk: string): unknown;
columns?: number;
rows?: number;
isTTY?: boolean;
}Types
Options
type Options = LogUpdateOptions;