@jsvision/core / createDecoderState
Function: createDecoderState()
createDecoderState():
DecoderState
Defined in: input/decoder.ts:66
Create a fresh, empty decoder state to pass into the first decode call: no carried bytes, no in-progress paste, not resyncing.
Returns
A new, empty DecoderState.
Example
ts
import { createDecoderState, decode } from '@jsvision/core';
let state = createDecoderState();
const enc = new TextEncoder();
const result = decode(enc.encode('\x1b[C'), state); // right-arrow: ESC [ C
state = result.state; // thread the state forward for the next chunk