@jsvision/ui / createApplication
Function: createApplication()
createApplication(
opts):Application
Defined in: ui/src/app/application.ts:207
Create a terminal application: assemble the event loop, desktop, optional menu bar/status line, and popup overlay, register the standard window-management commands, and return an Application.
The whole view tree is built and mounted in one pass; the menu bar and status line are wired to the loop after it exists. Populate the returned desktop with windows and call run() to start.
Parameters
opts
All optional: caps (auto-detected by default), viewport/theme/logger/keymap/menu/status/runtime/streams.
Returns
The assembled Application.
Example
ts
import { createApplication, Window, menuBar, subMenu, item, statusLine, statusItem, Commands } from '@jsvision/ui';
// Zero-config: capabilities are auto-detected and everything imports from one package.
const bar = menuBar([
subMenu('~W~indow', [item('~T~ile', Commands.tile), item('~C~ascade', Commands.cascade), item('E~x~it', Commands.quit)]),
]);
const status = statusLine([statusItem('~T~ile', Commands.tile, 'F4'), statusItem('~Q~uit', Commands.quit, 'Alt+X')]);
const app = createApplication({ menuBar: bar, statusLine: status });
const win = new Window('Editor');
win.layout.rect = { x: 1, y: 2, width: 30, height: 8 };
app.desktop.addWindow(win);
const code = await app.run(); // runs until the 'quit' command; restores the terminal on exit
process.exit(code);