konchai
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Bubble Tea

Konchai

Gamepad event listener library

Usage

import { gamepad } from "konchai";

const gp = gamepad();

// Listen to any button
const unlisten1 = gp.change((name, value) => {
  console.log(name, value);

  if (gp.state.buttons.right && gp.state.buttons["face-top"]) {
    console.log("> + ^");
  }
});

// Listen to certain button
const unlisten2 = gp.on("home", (value) =>
  console.log(value ? "Home Pressed" : "Home Unpressed")
);

document.getElementById("stop-listen-to-gamepad-events-button").onclick =
  () => {
    unlisten1(), unlisten2();
  };

Readme

Keywords

none

Package Sidebar

Install

npm i konchai

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

7.46 kB

Total Files

5

Last publish

Collaborators

  • artemis69