Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lebogoo/linux-joystick
A simple package to get joystick/gamepad information via linux device files, without any dependencies and prebuilt binaries.
https://github.com/lebogoo/linux-joystick
Last synced: about 2 months ago
JSON representation
A simple package to get joystick/gamepad information via linux device files, without any dependencies and prebuilt binaries.
- Host: GitHub
- URL: https://github.com/lebogoo/linux-joystick
- Owner: LeBogoo
- Created: 2022-07-04T17:18:08.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-04T19:24:57.000Z (over 2 years ago)
- Last Synced: 2024-10-30T03:55:03.479Z (2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/linux-joystick
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```js
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.