API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classChordAction

@codexo/exojs / input / stable

Button-like action active while every channel in a chord is held at once - `Control+S`, a modifier held alongside a gamepad button, and so on. Exposes the same `active`/`pressed`/`released`/`value` quartet as ButtonAction, but the aggregate is the weakest of every bound channel instead of the strongest of a set of alternatives: `min(|v|) > threshold` for every bound channel holds if and only if every one of them individually exceeds threshold, so a chord is only ever as "on" as its least-engaged member. For an analog chord (a gamepad trigger held alongside a button, say), value reports the trigger's pull limited by whether the button is engaged at all - `0` the instant any member releases, never the button's own binary 0/1. `'|'` alternates between whole chords - `'Control+S|Meta+S'` is active while EITHER modifier is held alongside `S`. This composes the same strongest/weakest reduction one level deeper: each alternative reports its own weakest member as above, and the action reports the strongest of those alternatives, so an analog alternative's `value` still reflects its own least-engaged member rather than collapsing to a plain boolean. A string binding resolves `+`/`|`-joined tokens as case-insensitive Keyboard enum names (`'Control+S'`, `'control+s'`). This is a shortcut list syntax for enum lookups, not text or IME input - it never decodes typed characters, dead keys, or composed input, and rejects any token that is not a known `Keyboard` member. Use an array of InputChannels directly to include pointer or gamepad channels, or for a sequence with more than one step, use SequenceAction. A string LITERAL is additionally checked at compile time, so a typo (`'Ctrl+Sv'`), a stray separator (`'A++B'`) or a `'>'` that belongs to SequenceAction is a type error naming the reason rather than a throw on the first frame that constructs the action. A pattern that is only known at runtime - read from a config file, assembled from parts, or passed in from JavaScript - types as plain `string` and is checked by the parser alone, exactly as before.

8
props
2
methods
0
events
Import
import { ChordAction } from '@codexo/exojs'

Button-like action active while every channel in a chord is held at once - `Control+S`, a modifier held alongside a gamepad button, and so on. Exposes the same `active`/`pressed`/`released`/`value` quartet as ButtonAction, but the aggregate is the weakest of every bound channel instead of the strongest of a set of alternatives: `min(|v|) > threshold` for every bound channel holds if and only if every one of them individually exceeds threshold, so a chord is only ever as "on" as its least-engaged member. For an analog chord (a gamepad trigger held alongside a button, say), value reports the trigger's pull limited by whether the button is engaged at all - `0` the instant any member releases, never the button's own binary 0/1.

`'|'` alternates between whole chords - `'Control+S|Meta+S'` is active while EITHER modifier is held alongside `S`. This composes the same strongest/weakest reduction one level deeper: each alternative reports its own weakest member as above, and the action reports the strongest of those alternatives, so an analog alternative's `value` still reflects its own least-engaged member rather than collapsing to a plain boolean.

A string binding resolves `+`/`|`-joined tokens as case-insensitive Keyboard enum names (`'Control+S'`, `'control+s'`). This is a shortcut list syntax for enum lookups, not text or IME input - it never decodes typed characters, dead keys, or composed input, and rejects any token that is not a known `Keyboard` member. Use an array of InputChannels directly to include pointer or gamepad channels, or for a sequence with more than one step, use SequenceAction.

A string LITERAL is additionally checked at compile time, so a typo (`'Ctrl+Sv'`), a stray separator (`'A++B'`) or a `'>'` that belongs to SequenceAction is a type error naming the reason rather than a throw on the first frame that constructs the action. A pattern that is only known at runtime - read from a config file, assembled from parts, or passed in from JavaScript - types as plain `string` and is checked by the parser alone, exactly as before.

Constructors1
Methods2
_allocateValues(): void
Size _values to the current channel list. Called from every _resolve.
Properties8
kind: "chord"
Which action kind this is - the discriminant a serialized binding is validated against.
active: boolean
true while the aggregate value exceeds the action's threshold.
binding: Binding
The 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: Binding
The binding this action was constructed with - what a null rebind restores.
pressed: boolean
true 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: boolean
true on the frame the aggregate value crossed back below the threshold. See pressed.
value: number
Aggregate 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