npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gamepad-events

v0.7.0

Published

<a name="GamePadManager"></a>

Downloads

2

Readme

GamePadManager ⇐ EventEmitter

A helper to manage gamepad inputs.

Kind: global class
Extends: EventEmitter
See: https://github.com/primus/eventemitter3 eventemitter3

new GamePadManager([config])

Constructor.

| Param | Type | Description | | --- | --- | --- | | [config] | Object | The configuration object. | | [config.buttonThreshold] | Number | The threshold to trigger button events. Used for analog buttons / triggers with variable values and not binary ones. | | [config.axisThreshold] | Number | The threshold to trigger axis events. | | [config.longpressThreshold] | Number | The threshold to trigger longpress. | | [config.repeatThreshold] | Number | The threshold to trigger repeat. | | [config.repeatRate] | Number | The time between repeat events. |

gamePadManager.update()

Update the gamepad manager, this handles button/axis events, as well as updating the internal state and setting up the delta.

Kind: instance method of GamePadManager

gamePadManager.isDown(target, player) ⇒ Boolean

Check if a button is pressed or held.

Kind: instance method of GamePadManager
Returns: Boolean - IsDown If the button is pressed or held.

| Param | Type | Default | Description | | --- | --- | --- | --- | | target | String | | The button to check if is down. | | player | Number | -1 | The gamepad to check, if -1, all are checked. |

gamePadManager.getStick(target, player) ⇒ Object

Get the state of a stick.

Kind: instance method of GamePadManager
Returns: Object - The x,y state of the stick.

| Param | Type | Default | Description | | --- | --- | --- | --- | | target | String | | The stick name. | | player | Number | -1 | The index of the player to get. |

gamePadManager.on(event, listener, context) ⇒ EventEmitter

Add an event listener. These are namespaced as well, so you can do down:axis_0 to get the specific axis event.

Kind: instance method of GamePadManager

| Param | Type | Description | | --- | --- | --- | | event | string | The name of the event. | | listener | function | The name of the event. | | context | object | The context to be used as 'this' in the listener. |

gamePadManager.once(event, listener, context) ⇒ EventEmitter

Add an event listener. These are namespaced as well, so you can do down:axis_0 to get the specific axis event.

Kind: instance method of GamePadManager

| Param | Type | Description | | --- | --- | --- | | event | string | The name of the event. | | listener | function | The name of the event. | | context | object | The context to be used as 'this' in the listener. |

gamePadManager.off(event, listener) ⇒ EventEmitter

Remove an event listener. These are namespaced as well, so you can do down:axis_0 to get the specific axis event.

Kind: instance method of GamePadManager

| Param | Type | Description | | --- | --- | --- | | event | string | The name of the event. | | listener | function | The name of the event. |

gamePadManager.removeAllListeners(event) ⇒ EventEmitter

Remove all listeners from an event. These are namespaced as well, so you can do down:axis_0 to get the specific axis event.

Kind: instance method of GamePadManager

| Param | Type | Description | | --- | --- | --- | | event | string | The name of the event. |