@jsvision/web / createBrowserHost
Function: createBrowserHost()
createBrowserHost(
options):BrowserHost
Defined in: host.ts:125
Build a BrowserHost over an xterm.js-style terminal.
Call start() once, then render() each frame and setCaret() on each caret update. The bytes render() writes with no previous frame equal serialize(buffer, null, { caps }) exactly — the engine is reused, not reimplemented.
Parameters
options
the terminal, the capability profile, the input sink, and an optional timer seam.
Returns
the host handle.
Example
ts
import { Terminal } from '@xterm/xterm';
import { createBrowserHost, buildBrowserCaps } from '@jsvision/web';
const term = new Terminal({ allowProposedApi: true });
term.open(document.getElementById('terminal')!);
const caps = buildBrowserCaps();
const host = createBrowserHost({ term, caps, onInput: (event) => loop.dispatch(event) });
host.start();
host.render(loop.renderRoot.buffer()); // paint the first frame