esm-gamecontroller.js
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

🎮 esm-gamecontroller.js

A esm port of gamecontroller.js.

All credit goes to:

However the original author doesn't seem to be active anymore, so I took JumpLink TS version and made a build step to convert it to ESM which is recommended if you want to include the source in your final build anyway.

On top of that I wrote some mappings so it's easier to find a button and use them in functions, e.g.

import {XBoxButton} from 'esm-gamecontroller.js';

gamepad.on(XBoxButton.START, () => {
	// ... pause the game or continue
})

Installation

npm add -D esm-gamecontroller.js

Usage

import gameControl, { GCGamepad } from 'esm-gamecontroller.js';

gameControl.on('connect', (gamepad: GCGamepad) => {
	// May the types lead you young padawan...
})

Package Sidebar

Install

npm i esm-gamecontroller.js

Weekly Downloads

121

Version

1.0.4

License

MIT

Unpacked Size

53.6 kB

Total Files

59

Last publish

Collaborators

  • vdegenne