UNPKG

@rbuljan/gamepad

Version:

Multi-touch gamepad with buttons and joystick for JavaScript games, apps, IOT

47 lines (46 loc) 1.36 kB
/** * Gamepad */ import { Button } from "./controllers/button"; import { Controller } from "./controllers/controller"; import { Joystick } from "./controllers/joystick"; export { Gamepad, Button, Joystick }; declare class Gamepad { controllers: Map<string, Controller>; constructor(controllersArray?: Controller[]); /** * Add Controller to Gamepad * @param controllers or a Button or Joystick Controller instance. */ add(...controllers: Controller[]): this; /** * Remove/destroy controller by ID * @param id Controller ID to remove */ remove(id: string): void; /** * Remove/destroy all controllers (or one by ID) * @param id (Optional) Controller ID or Controller instance */ destroy(id: string): void | this; handleFullscreen(): void; /** * Call this function to add a listener to request Fullscreen API */ requestFullScreen(): void; /** * Exit fullScreen */ exitFullScreen(): this; /** * Check if Navigator supports vibration * @returns True if vibration is supported */ isVibrationSupported(): boolean; /** * Vibrate Gamepad! * Use a milliseconds integer or an array of pattern like: [200,30,100,30,200] * where 30 is the pause in ms. */ vibrate(vibrationPatternMsArray: number[]): this; }