API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classButtonAction
@codexo/exojs / input / stable
A named on/off input, fed by one source or by several interchangeable ones. Sources may be digital (a key) or analog (a trigger) - the action reports the strongest of them and compares it against its own threshold.
8
props
2
methods
0
events
Import
import { ButtonAction } from '@codexo/exojs'A named on/off input, fed by one source or by several interchangeable ones. Sources may be digital (a key) or analog (a trigger) - the action reports the strongest of them and compares it against its own threshold.
Constructors1
new(binding: ButtonBindingSources a ButtonAction accepts: one channel, or several interchangeable ones., options: ActionOptionsOptions shared by every action.): ButtonActionMethods2
_allocateValues(): voidSize _values to the current channel list. Called from every _resolve.
This action's effective binding in persistable form.
Properties8
kind: "button"Which action kind this is - the discriminant a serialized binding is validated against.
active: booleantrue while the aggregate value exceeds the action's threshold.
binding: BindingThe binding currently in effect: the default, or whatever last replaced it.
channels: readonly number[]Absolute channel indices this action reads right now. Reflects the effective binding and the owning map's gamepad slot, and is what an InputScope claims on this action's behalf. The array is replaced, not mutated, on every rebind - do not retain it across one.
defaultBinding: BindingThe binding this action was constructed with - what a null rebind restores.
pressed: booleantrue on the frame the AGGREGATE value crossed above the action's own threshold. Bound sources are replayed in the true order their channels changed, batch by whole batch (see ChannelEventBatch's doc comment - every channel a single real-world event wrote together is applied before the aggregate is evaluated even once), so a value that crosses the threshold twice within one frame (0.4 → 0.7 → 0.4 at threshold 0.5) sets both pressed and released on that same frame, while a source that never actually reaches the threshold (0 → 0.1 → 0 at threshold 0.5) sets neither. A second, alternative source tapping while a first stays continuously active never manufactures an edge either, because the aggregate itself never drops below threshold.
released: booleantrue on the frame the aggregate value crossed back below the threshold. See pressed.
value: numberAggregate source value this frame, in 0..1. Reads 0 on a frame where the source was pressed and released again between two frame boundaries - check pressed for that case rather than the value.
Source