UNPKG

interactive-gpio-node

Version:

45 lines (44 loc) 1.62 kB
import { Observable } from "rxjs"; import { BoutonConfig } from "./model/boutonConfig"; import { BoutonInterface } from "./model/BoutonInterface"; /** * Interface used to describe a keyboard button * * @property {string} name - The name of the button * @property {boolean} ctrl - A boolean indicating if the Ctrl button is pressed * @property {boolean} meta - A boolean indicating if the Meta button (e.g Windows key) is pressed * @property {boolean} shift - A boolean indicating if the Shift button is pressed * @property {string} sequence - A string containing the character sequence generated by the button * @property {string} code - A numerical code for the button */ export interface BoutonKeyboardCLI { name: string; ctrl: boolean; meta: boolean; shift: boolean; sequence: string; code: string; } /** * Class used to listen for key press events on stdin and return an Observable * * @property {Observable<BoutonKeyboardCLI>} key - An observable that will emit a BoutonKeyboardCLI object when a configured key is pressed */ export declare class BoutonCLI implements BoutonInterface { keyDebug: Observable<BoutonKeyboardCLI> | null; keys: { [keyboard: string]: Observable<boolean>; }; pin: { [label: string]: number; }; private keypress; /** * * @param buttons * @param {boolean} debug - A boolean indicating if all keys should be displayed or not. Default is false */ constructor(buttons: BoutonConfig[], debug: boolean); configureButtons(buttons?: BoutonConfig[]): void; private configureButtonsDebug; }