1.0.2 • Published 2 years ago

linux-joystick v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

linux-joystick

A simple package to get joystick/gamepad information via linux device files, without any dependencies and prebuilt binaries.

Installation

npm install linux-joystick

Usage

const { JoystickDevice, listDevices } = require("linux-joystick");

const devicePath = listDevices()[0];
const joystick = new JoystickDevice(devicePath);

joystick.on("button_pressed", (event) => {
  console.log("Pressed button:", event);
});

Methods:

  • getButton(number)
  • getAxis(number)

Events:

  • button_changed
  • axis_changed
  • button_pressed
  • button_released
  • button_init
  • axis_init

Helper functions

  • listDevices() -> Returns an array with all joystick/gamepad devices.
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago