Skip to content

@ue-too/board / index / expandTouchInputStateMachine

Function: expandTouchInputStateMachine() ​

expandTouchInputStateMachine<E, C, S, O>(context, define, initialState): TemplateStateMachine<E, C, S, O>

Defined in: packages/board/src/input-interpretation/input-state-machine/touch-input-state-machine.ts:493

Builds a touch input state machine with more events, states, context or outputs than the stock one, reusing every built-in state.

Type Parameters ​

E ​

E extends TouchEventMapping

C ​

C extends TouchContext

S ​

S extends string

O ​

O extends TouchInputEventOutputMapping & Partial<Record<keyof E, unknown>>

Parameters ​

context ​

C

The expanded context; must satisfy TouchContext

define ​

[TouchStates] extends [S] ? TouchInputStateMachineExpansion<E, C, S, O> : object

Receives the stock states and an extend helper, returns the expanded state map. See TouchInputStateMachineExpansion.

initialState ​

S = ...

Defaults to 'IDLE'

Returns ​

TemplateStateMachine<E, C, S, O>

A machine over the expanded generics

Remarks ​

Same rules as expandKmtInputStateMachine: every generic must be a superset of the stock one, S must include every TouchStates member, and shared events keep the stock payload.