hold

fun hold(button: Button, command: Command)

Sets the command supplier to be executed when the specified button is held.

This overload accepts a supplier of a Command. If the button was previously bound, only the hold command is updated; the press and release commands remain unchanged.

Parameters

button

The button to bind.

command

The command supplier for the hold event.

Example:

hold(Button.A, MyHoldCommand())

fun hold(button: Button, command: () -> Unit)

Sets the command supplier to be executed when the specified button is held.

This overload accepts a lambda of type () -> Unit, which is wrapped in an InstantCommand. Useful for simple actions that do not require a full Command implementation.

Parameters

button

The button to bind.

command

The lambda to execute for the hold event.

Example:

hold(Button.B) { println("Holding B!") }