@jsvision/ui / RouterApplication
Interface: RouterApplication
Defined in: ui/src/app/application.ts:167
An application whose body is a custom content view (e.g. a router); it has no window manager.
Extends
Properties
desktop
readonlydesktop:undefined
Defined in: ui/src/app/application.ts:169
No window manager: a content app manages its own body.
Overrides
loop
readonlyloop:EventLoop
Defined in: ui/src/app/application.ts:105
The underlying event loop. Use it to emit commands, manage focus, or run modals.
Inherited from
Methods
menuBase()
menuBase():
MenuItem[]
Defined in: ui/src/app/application.ts:152
The application's base menu items — the top-level menu nodes createApplication({ menuBar }) was given. Menu items are plain data (not views), so this returns a shallow copy safe to compose with withBase.
Returns
MenuItem[]
A copy of the base menu's top-level items (empty if no menu bar).
Example
menu: withBase(app.menuBase(), [subMenu('~S~creen', [item('~E~dit', 'detail.edit')])]);Inherited from
onCommand()
onCommand(
command,handler): () =>void
Defined in: ui/src/app/application.ts:119
Register an app-wide handler for a named command; returns a function that unregisters it. Every handler registered for a command runs when that command is emitted, and a handled command is consumed there. Forwards to loop.onCommand — see it for the pre-process ordering and the modal-open caveat.
Parameters
command
string
The command name to handle (e.g. a menu/status item's command).
handler
() => void
Called when the command is emitted.
Returns
A function that unregisters this handler (idempotent).
() => void
Example
const off = app.onCommand('about', () => messageBox(app, { title: 'About', text: '…' }));
// later: off(); // stop handling 'about'Inherited from
run()
run():
Promise<number>
Defined in: ui/src/app/application.ts:157
Connect to the terminal and run until the 'quit' command, resolving to the exit code. The terminal is always restored on exit — normal, thrown, or signalled.
Returns
Promise<number>
Inherited from
setTheme()
setTheme(
theme):void
Defined in: ui/src/app/application.ts:129
Replace the active theme at runtime and repaint every view with the new colors in one coalesced frame. Forwards to loop.setTheme, so it is safe to call from a command handler or a bare imperative call — the repainted frame reaches the terminal even outside an input tick.
Parameters
theme
Theme
The theme to switch to (a preset, a createTheme result, or a parseTheme result).
Returns
void
Example
app.onCommand('theme:nord', () => app.setTheme(nordTheme));Inherited from
statusBase()
statusBase():
View[]
Defined in: ui/src/app/application.ts:142
A fresh copy of the application's base status items — the global affordances (e.g. quit/help) a screen composes with its own hints via withBase. Each call rebuilds new item views, because a view has a single parent: composing with the live base bar's own instances would re-parent them and corrupt the fallback bar. Only command items are reproduced (spacers/widgets are not part of a composable base).
Returns
View[]
Fresh status-item views mirroring the base bar's command items (empty if no status line).
Example
// A screen's status = the app base plus a screen-specific action:
status: withBase(app.statusBase(), [statusItem('~E~dit', 'detail.edit')]);