ImplantServer LaunchPadObject

Implant Server API Reference > LaunchPadObject

LaunchPadObject
This object provides all I/O functionality with the LaunchPad hardware from javascript implants. It is provided via implant.launchPad or this.launchPad from within server implants.

Properties

 * width - the horizontal size of the active area on the LaunchPad
 * height - the vertical size of the active area on the LaunchPad

Methods
put methods here.
 * setColor(x, y, color) - Changes the color of a launchpad button within the active area.  Coordinates outside this area are ignored.  Currently, only the following color names can be used, but in the future other ways to specify colors will be added:
 * off - turns the button off
 * red
 * redorange
 * orange
 * amber
 * yellow
 * yellowgreen
 * green
 * on(eventName, callback) - Sets a function to be called whenever a certain event is received within the active area of the implant from the LaunchPad.  This will be greatly expanded in the future.  The following events are supported:
 * press - Callback will receive LaunchPadPresEvent argument with x and y of button pressed
 * release - event has x and y of button pressed
 * doublepress - event has x and y of button pressed within some timeframe

TODO: show examples.

These methods below are temporarily and will be replaced and moved, but are needed in v0.01 alpha for testing and proving test cases.
 * setInterval(callback, msec) - provides the same functionality as the javascript standard version, which is not available.  Returns the ID to use with clearInterval.  The callback function is called at the rate determined by the 2nd argument.  this should be either moved into the implant object or replaced with an event using on
 * clearInterval(id) - removes a previously started interval using the ID returned by setInterval.
 * print(msg) - prints a text message to the console window
 * wait - prints a message "Press enter to continue javascript" on the console and stops execution until enter is pressed.