# flagstaff/log-update

> Every export of flagstaff/log-update, with its signature and doc comment: createLogUpdate, logUpdateStderr, logUpdate, plus 4 types.

Source: https://flagstaff.interlace.tools/docs/api/log-update

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

```ts
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.

```ts
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`.

```ts
const logUpdate: LogUpdate;
```

### logUpdateStderr

```ts
const logUpdateStderr: LogUpdate;
```

## Interfaces

### LogUpdate

```ts
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

```ts
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.

```ts
interface LogUpdateStream {
    write(chunk: string): unknown;
    columns?: number;
    rows?: number;
    isTTY?: boolean;
}
```

## Types

### Options

```ts
type Options = LogUpdateOptions;
```
