ImplantServer LaunchPadPressEvent

Implant Server API Reference > LaunchPadPressEvent

LaunchPadPressEvent
This is the type of object sent to registered callback functions when a button is pressed or released on the LaunchPad within the active area of the implant.

Events
The following types of events have this object sent as an argument to registered callbacks:
 * press - triggered when a launchpad button is first pushed down
 * released - triggered when a launchpad button is released
 * doublepress - triggered then a 2nd press occurs within a period of time

Properties
Each event object has the following information available.
 * x - the column of the button, relative to the upper-left corner of the active area of the implant
 * y - the row of the button, relative to the active area
 * type - the type of event:  press, release, or doublepress

Examples
Here are some examples of using a LaunchPressEvent. This first one will highlight the button in red while a button is held down: implant.launchPad.on('press', function(e) {

implant.launchPad.setColor(e.x, e.y, 'red');

});

implant.launchPad.on('release', function(e) {

  implant.launchPad.setColor(e.x, e.y, 'off');

});