pxt-calliope/libs/core/input.ts
Peli de Halleux 5d8ccd1d6d adding namespace to api categories ()
* adding namespace to api categories

* add icon for led

* adding icons for control, game, images, pins and serial.
2017-01-05 07:01:50 -08:00

51 lines
1.3 KiB
TypeScript

/**
* Events and data from sensors
*/
//% color=#B4009E weight=99 icon="\uf192"
namespace input {
/**
* Attaches code to run when the screen is facing up.
* @param body TODO
*/
//% help=input/on-screen-up
export function onScreenUp(body: Action): void {
onGesture(Gesture.ScreenUp, body);
}
/**
* Attaches code to run when the screen is facing down.
* @param body TODO
*/
//% help=input/on-screen-down
export function onScreenDown(body: Action): void {
onGesture(Gesture.ScreenDown, body);
}
/**
* Attaches code to run when the device is shaken.
* @param body TODO
*/
//% help=input/on-shake
export function onShake(body: Action): void {
onGesture(Gesture.Shake, body);
}
/**
* Attaches code to run when the logo is oriented upwards and the board is vertical.
* @param body TODO
*/
//% help=input/on-logo-up
export function onLogoUp(body: Action): void {
onGesture(Gesture.LogoUp, body);
}
/**
* Attaches code to run when the logo is oriented downwards and the board is vertical.
* @param body TODO
*/
//% help=input/on-logo-down
export function onLogoDown(body: Action): void {
onGesture(Gesture.LogoDown, body);
}
}