ESC
Type to search...
S
Soli Docs

Events

"on": {"click": "toggle"} names a server event. When it fires, the handler's params carry the node id, the event kind, its payload, and — because the server kept the tree — the node's props. Nothing a client sends is trusted: three things are checked before a handler runs — the node exists in the tree this server last sent, it carries a handler of that kind naming that name, and the payload is the shape the kind declares. An event that fails any of them is dropped, not an error and not the end of the session: an event may arrive from a client one render behind, naming a node that existed a moment ago, and closing the session there would cost somebody their application for a mouse movement — while making one malformed frame an attack on every reader. EUI_TRACE=1 prints what was dropped and why.

Every event kind

29 of them. A kind the view has not declared cannot arrive.

KindFires when
clickA press and release on the node.
double_clickTwo clicks inside the double-click interval.
pointer_downThe pointer went down on the node.
pointer_upAnd came back up.
pointer_moveThe pointer moved while over the node.
pointer_enterThe pointer entered the node.
pointer_leaveThe pointer left it.
key_downA key went down while the node had focus.
key_upAnd came back up.
text_inputText was typed or composed into the node.
focusThe node took keyboard focus.
blurIt lost focus.
changeA field's value settled.
submitA form-shaped group was submitted.
scrollThe node was scrolled.
resizeThe node's box changed size.
context_menuThe secondary button, or its platform equivalent.
drag_startA drag began on the node.
drag_overA drag passed over it.
dropA drag was released on it.
long_pressA press held past the platform threshold.
windowThe window itself changed — moved, resized, closed.
endedMedia finished playing.
time_updateMedia playback advanced.
wakeThe session's own clock fired.
file_pickA file dialog returned a choice.
file_saveA save dialog returned a destination.
locationA position fix from the device. Phone only.
nfc_tagAn NFC tag came within range. Phone only.

file_pick, file_save, location and nfc_tag are answered by the client, and the last two are compiled only for a phone: a desktop has no tag reader and no positioning it can reach.

Waking a session

A component may ask to be woken on a clock — the wake event. On its own that makes every window a poller: it learns what someone else did only when its own clock next fires, and spends a render per period discovering that nothing happened.

eui_wake(component) is the other half — it renders every other live session of a component immediately, from wherever the change was written.

def send(state, params)
  Message.create({ "room": state["room"], "body": params["value"] })
  eui_wake("chat")        # every other window showing this component, now
  state
end