Configure how event callbacks are dispatched from the browser to the
server. Pass the result to an element's .event prop to control timing
for all events on that element (auto-bind synthetic write-back plus
any explicit on* handlers).
Usage
event_immediate(coalesce = FALSE)
event_throttle(ms, leading = TRUE, coalesce = TRUE)
event_debounce(ms, coalesce = TRUE)Arguments
- coalesce
If
TRUE, gate on server idle so events never queue faster than the server can process them. Defaults toFALSEforevent_immediate()andTRUEforevent_throttle()/event_debounce().- ms
Minimum interval (throttle) or quiet period (debounce) in milliseconds.
- leading
If
TRUE(default), fire immediately on the first event. IfFALSE, wait for the timer before firing.
Details
event_immediate(): Fires on every event with no rate limiting.event_throttle(): Fires at most everymsmilliseconds while the event is active.event_debounce(): Waits until the user pauses formsmilliseconds before firing.
When .event is omitted, irid applies a per-event default keyed on the
DOM event name: input → event_debounce(200) (typing produces a flood
of intermediate values), every other event → event_immediate(). The
rule is the same whether the event entry came from an auto-bind synthetic
or an explicit on* handler, so adding value = rv to an existing
onInput doesn't silently shift its timing.
.event accepts either a single config struct (applies to every event
on the element) or a named list for per-event overrides. List keys may
use either the lowercase DOM event name (input, change, keydown)
or the matching on-prop name (onInput, onChange, onKeyDown);
both forms normalize to the lowercase DOM event. Events not covered by
the list fall back to the per-event default. Malformed .event values
(a non-config, an unnamed list, or a list whose entries are not all
configs) raise an error during tag processing.
Use the element-level .prevent_default prop to call
event.preventDefault() in the browser before dispatch. Like .event,
it accepts either a logical scalar (broadcasts to every event on the
element) or a named list keyed by DOM event for per-event overrides;
unmapped events default to FALSE.
The event object
The event argument passed to handlers is a list containing all
primitive-valued properties (string, numeric, logical) from the browser
event object, plus these element properties:
valueThe element's current value (character).
valueAsNumberNumeric value of the element, or
NAif the input is empty or non-numeric (e.g. a blank text box). Useful for range and number inputs.checkedLogical, for checkbox and radio inputs.
Keyboard events additionally include key, code, ctrlKey,
shiftKey, altKey, and metaKey.
