Socket
Socket
Sign inDemoInstall

jsgamepad

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jsgamepad

W3C Gamepad API Simplified & Implementation fixes


Version published
Weekly downloads
3
Maintainers
1
Install size
594 kB
Created
Weekly downloads
 

Readme

Source

jsGamepad

NPM Version NPM Downloads License

W3C Gamepad API Simplified & Implementation fixes

Demo

Specification

Gamepad API, W3C

Fixes

This lib fixes a bug in Chrome, where the connected event will be emitted instead of the disconnected event.

Usage

I suggest you to use jspm as your package manager.

import gamepad from "jsgamepad";

gamepad.on("connected", (gamepad) => {
  console.log("connected " + gamepad.index);
}).on("disconnected", (gamepad) => {
  console.log("disconnected " + gamepad.index);
}).on("buttonPressed", ({ button, buttonIndex, gamepad }) => {
  console.log("pressed " + buttonIndex);
}).on("buttonReleased", ({ button, buttonIndex, gamepad }) => {
  console.log("released " + buttonIndex);
});

// start loop for buttons and axes detection
gamepad.watch();

Directly in a browser

Please checkout the index-dist.html file for direct usage in a browser.

TODO

  • API

License

MIT

Keywords

FAQs

Last updated on 06 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc