Skip to content

createEventInput

createEventInput<TAction>(map, providers): EventInput<TAction>

Defined in: src/modules/input/event-input.ts:57

Wires one or more InputProviders to an action map and returns an event-dispatched EventInput.

Edges are action-level and identical to createInput’s: a down event fires when an action transitions from zero aliased codes down to at least one, an up event when the last one releases. Pressing a second alias while the first is held does NOT re-fire down, and OS key-repeat is deduped — so holding a key produces one down, not a stream.

Dispatch is synchronous, from the provider’s own DOM listener. A handler therefore runs mid-tick if the key arrives mid-tick, matching Godot’s _input (which runs outside _process). Consumers that need actions applied at a turn or tick boundary enqueue inside their handler and drain at that boundary; this module deliberately owns no queue.

Providers are NOT started here — KeyboardProvider attaches its listeners on construction. The factory simply subscribes for the translation layer.

A throwing handler propagates out to the provider’s listener; it is not swallowed, and the remaining handlers for that edge are skipped.

TAction extends string

InputMap<TAction>

readonly InputProvider[]

EventInput<TAction>