key.settings.callbackKey element

getKey(id).settings.callback( command )

or getKey(id).settings.callback( command1, command2 )

Will execute the command(s) whenever a key corresponding to the element is pressed.

Example:

newText("sentence", "Hello world")
    .print()
,
newVar("word", 0)
,
newKey("control", " \n\r")
    .settings.callback(
        getText("sentence")
            .settings.color("red")
        ,
        newTimer(1000)
            .start()
            .wait()
        ,
        getText("sentence")
            .settings.color("black")
    )

Prints Hello world onto the page and will highlight it in red for 1s whenever the Space or the Enter/Return key is pressed.