@cartridge-engine/keyboard-engine
    Preparing search index...

    Function tryMatchBindings

    • Iterate through a list of bindings and fire the first matching handler.

      Matches exact key names first, then falls back to the wildcard "*" binding for normal character input (see isNormalCharacter).

      A binding fires only when ALL of the following are satisfied (AND relationship):

      1. skipBinding returns false / absent (covers stopsWorkingAfterLayerAppearing)
      2. when returns true / absent (covers conditional enablement)
      3. Key name matches one in binding.keys

      The short-circuit evaluation order is skipBinding → when → keyMatch. This order does NOT create priority among the conditions — they are logical AND peers. Whether skipBinding is checked before or after when, all must pass for the binding to fire.

      Type Parameters

      Parameters

      • bindings: T[]

        Ordered list of key bindings to try.

      • currentMode: string | null
      • availableKeys: string[]

        Normalized key names available for matching at this layer.

      • input: string

        Raw character from the framework's keyboard event.

      • key: unknown

        Full Key descriptor from the framework.

      • conditions: Map<string, boolean>
      • isNormalChar: (key: unknown) => boolean
      • OptionalskipBinding: (binding: T) => boolean

        Optional predicate to skip individual bindings (used for stopsWorkingAfterLayerAppearing enforcement).

      Returns boolean

      true if a binding matched and consumed the event.