key.callback

description

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

syntax

getKey(ELEMENT_NAME).callback(command)
  • command :

alternate(s)

  • getKey(ELEMENT_NAME).callback( command1, command2 )


example(s)


@newText("sentence", "Hello world")
@    .print()
@,
@newVar("word", 0)
@,
@newKey("control", " \n\r")
$    .callback(
$        getText("sentence")
$            .color("red")
$        ,
$        newTimer(1000)
$            .start()
$            .wait()
$        ,
$        getText("sentence")
$            .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.