Skip to content

InputQueue

Defined in: packages/runtime/src/wasm/tty-bridge.ts:113

A byte queue that implements WasmTTYInput.

Wire up your input source by calling push / pushString / pushBytes as bytes arrive, and call close() to signal EOF.

optional closed?: boolean

Defined in: packages/runtime/src/wasm/tty-bridge.ts:62

Whether the input source has been closed (EOF).

WasmTTYInput.closed

available(): number

Defined in: packages/runtime/src/wasm/tty-bridge.ts:52

Number of bytes immediately available (no blocking).

number

WasmTTYInput.available


close(): void

Defined in: packages/runtime/src/wasm/tty-bridge.ts:121

Signal that no more input will arrive (EOF). Pending waitForByte() resolves with -1.

void


push(byte): void

Defined in: packages/runtime/src/wasm/tty-bridge.ts:115

Push a single byte.

number

void


pushBytes(data): void

Defined in: packages/runtime/src/wasm/tty-bridge.ts:119

Push raw bytes from a Uint8Array (e.g., Node.js stdin chunks).

Uint8Array

void


pushString(data): void

Defined in: packages/runtime/src/wasm/tty-bridge.ts:117

Push each char of a string as a byte (charCodeAt). Handles multi-char xterm.js onData.

string

void


shift(): number

Defined in: packages/runtime/src/wasm/tty-bridge.ts:54

Consume one byte. Only call when available() > 0.

number

WasmTTYInput.shift


optional waitForAvailable(): Promise<void>

Defined in: packages/runtime/src/wasm/tty-bridge.ts:60

Returns a promise that resolves when input becomes available, without consuming any bytes. Used by poll() to wait for readiness.

Promise<void>

WasmTTYInput.waitForAvailable


waitForByte(): Promise<number>

Defined in: packages/runtime/src/wasm/tty-bridge.ts:57

Returns a promise that resolves with the next byte when one arrives. Resolves with -1 when the input is closed and the buffer is empty.

Promise<number>

WasmTTYInput.waitForByte