Skip to content

@jsvision/web / mountApp

Function: mountApp()

mountApp(options): MountedApp

Defined in: mount.ts:82

Mount an application onto a terminal and start it.

Parameters

options

MountAppOptions

the mount point, the app, the caps, and either a ready term or a createTerminal factory (one is required, or it throws).

Returns

MountedApp

the MountedApp handle; call dispose() to tear it down.

Throws

if neither term nor createTerminal is supplied.

Example

ts
import { Terminal } from '@xterm/xterm';
import { createApplication } from '@jsvision/ui';
import { mountApp, buildBrowserCaps } from '@jsvision/web';

const caps = buildBrowserCaps();
const app = createApplication({ caps, viewport: { width: 80, height: 24 } });
const el = document.getElementById('terminal')!;
const mounted = mountApp({
  element: el,
  app,
  caps,
  createTerminal: () => { const t = new Terminal({ allowProposedApi: true }); t.open(el); return t; },
});
// later: mounted.dispose();