API reference

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

C

classGamepad

@codexo/exojs / input / stable

One of four stable gamepad slots. Lives for the entire `Application` lifetime even when no physical pad is attached — a "mailbox" that physical hardware moves into and out of. Subscribe to onConnect / onDisconnect for hardware lifecycle, onButtonDown / onButtonUp / onAxisChange for granular per-event notifications, or call onTrigger / onActive / onStart / onStop to register stateful InputBindings pinned to this slot. Listeners survive disconnect/reconnect cycles — a binding registered when the slot was empty will automatically activate when a pad connects.

8
props
10
methods
6
events
Import
import { Gamepad } from '@codexo/exojs'

One of four stable gamepad slots. Lives for the entire `Application` lifetime even when no physical pad is attached — a "mailbox" that physical hardware moves into and out of.

Subscribe to onConnect / onDisconnect for hardware lifecycle, onButtonDown / onButtonUp / onAxisChange for granular per-event notifications, or call onTrigger / onActive / onStart / onStop to register stateful InputBindings pinned to this slot.

Listeners survive disconnect/reconnect cycles — a binding registered when the slot was empty will automatically activate when a pad connects.

Constructors 1
new(slot: 0 | 1 | 2 | 3, channels: Float32Array): Gamepad
Methods 10
destroy(): void
hasChannel(channel: GamepadButtonChannel | GamepadAxisChannel): boolean
onActive(channel: InputChannel | readonly InputChannel[], callback: object, options?: InputBindingOptions): InputBinding
onStart(channel: InputChannel | readonly InputChannel[], callback: object, options?: InputBindingOptions): InputBinding
onStop(channel: InputChannel | readonly InputChannel[], callback: object, options?: InputBindingOptions): InputBinding
onTrigger(channel: InputChannel | readonly InputChannel[], callback: object, options?: InputBindingOptions): InputBinding
resolveChannelOffset(channel: GamepadButtonChannel | GamepadAxisChannel): number
stopVibration(): void
vibrate(options: GamepadVibrationOptions): Promise<void>
resolveChannelOffset(slot: number, channel: GamepadButtonChannel | GamepadAxisChannel): number
Properties 8
browserGamepad: Gamepad | null
canVibrate: boolean
connected: boolean
info: GamepadInfo | null
internalIndex: number | null
mapping: GamepadMapping | null
mappingFamily: GamepadMappingFamily | null
slot: 0 | 1 | 2 | 3
Events 6
onAxisChange: Signal<[GamepadAxis, number]>
onButtonDown: Signal<[GamepadButton, number]>
onButtonUp: Signal<[GamepadButton, number]>
onConnect: Signal<[]>
onDisconnect: Signal<[]>
onPadReassigned: Signal<[fromSlot]>
Source