@jsvision/ui / DispatchEvent
Interface: DispatchEvent
Defined in: ui/src/view/types.ts:127
The envelope wrapped around each event before it is routed to views. This — not the raw read-only input event — is what View.onEvent(ev) receives. A handler reads the event and sets handled to consume it, and uses the optional seams below (emit, focusView, capture, clipboard, …) to act on the app. Those seams are present during real dispatch and undefined in a bare envelope you might construct in a test, so always call them optional-chained (ev.emit?.(…)).
Properties
clickCount?
readonlyoptionalclickCount?:number
Defined in: ui/src/view/types.ts:139
For a mouse-down, how many consecutive clicks landed on the same cell (1 = single, 2 = double, 3 = triple…). Present only on a mouse-down during real dispatch; undefined otherwise. A row widget that activates on double-click checks ev.clickCount === 2.
emit?
readonlyoptionalemit?: (command,arg?) =>void
Defined in: ui/src/view/types.ts:144
Raise a typed command onto the current dispatch tick — how a widget signals an action (e.g. a button emitting 'ok') for a menu/status/app handler to pick up.
Parameters
command
string
arg?
unknown
Returns
void
event
readonlyevent:AppEvent
Defined in: ui/src/view/types.ts:129
The wrapped decoded input event or internal command.
focusView?
readonlyoptionalfocusView?: (view) =>void
Defined in: ui/src/view/types.ts:149
Move focus to another view — used e.g. by a Label to focus the control it labels. A non-focusable target is a no-op.
Parameters
view
Returns
void
getFocused?
readonlyoptionalgetFocused?: () =>View|null
Defined in: ui/src/view/types.ts:187
The currently-focused view. A dropdown control saves it before opening its popup and restores it on dismiss.
Returns
View | null
handled
handled:
boolean
Defined in: ui/src/view/types.ts:131
Set true by a handler to stop the event propagating to the remaining phases/views.
hasCapture?
readonlyoptionalhasCapture?: (view) =>boolean
Defined in: ui/src/view/types.ts:162
Whether view currently holds the pointer capture. A view mid-gesture (a window drag, a status press) checks this before applying a move, so if the capture was lost externally (a modal opened or closed mid-drag) the gesture aborts cleanly instead of jumping to the cursor.
Parameters
view
Returns
boolean
local?
readonlyoptionallocal?:Point
Defined in: ui/src/view/types.ts:133
Mouse/wheel coordinates translated to this view's local cells; absent for keys and commands.
observeClipboardWrite?
readonlyoptionalobserveClipboardWrite?: (listener) =>void
Defined in: ui/src/view/types.ts:175
Observe canonical clipboard writes made during this dispatch.
The subscription lasts only for the current routed event. A pre-processing view can use it to refresh a visible clipboard projection after any focused control calls setClipboard, without becoming another clipboard owner.
Parameters
listener
(text) => void
Returns
void
popupHost?
readonlyoptionalpopupHost?:PopupHost
Defined in: ui/src/view/types.ts:192
The overlay host a dropdown control mounts its anchored popup into. Present when an app shell (or a Dialog) has provided one; undefined in a headless/no-shell setup.
readClipboard?
readonlyoptionalreadClipboard?: () =>string
Defined in: ui/src/view/types.ts:182
Read the application's in-app clipboard buffer (the last text copied or cut within the app). Used by editable controls for in-app paste without reading the external OS clipboard. Returns '' when nothing has been copied yet, and is undefined on an event that was not routed through the loop (e.g. one constructed directly in a test) — always call it optional-chained.
Returns
string
releaseCapture?
readonlyoptionalreleaseCapture?: () =>void
Defined in: ui/src/view/types.ts:156
Release the pointer capture; a no-op if none is set. Pairs with setCapture.
Returns
void
setCapture?
readonlyoptionalsetCapture?: (view) =>void
Defined in: ui/src/view/types.ts:154
Capture the pointer to view: while captured, all mouse/wheel events route to view until releaseCapture. Used for drag gestures such as dragging a scrollbar thumb.
Parameters
view
Returns
void
setClipboard?
readonlyoptionalsetClipboard?: (text) =>void
Defined in: ui/src/view/types.ts:167
Commit text to the canonical application clipboard and offer it to the host adapter. Host synchronization may be unavailable, but the canonical write still succeeds.
Parameters
text
string
Returns
void