{"id":15390972,"url":"https://github.com/natemoo-re/gamepad","last_synced_at":"2025-07-13T14:36:55.464Z","repository":{"id":66278504,"uuid":"170331753","full_name":"natemoo-re/gamepad","owner":"natemoo-re","description":"Provides a simple, event-based API for Gamepads on the web","archived":false,"fork":false,"pushed_at":"2019-02-14T00:32:21.000Z","size":107,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-04T10:16:22.397Z","etag":null,"topics":["controller","gamepad","gamepad-api","gamepad-controller"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natemoo-re.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["natemoo-re"]}},"created_at":"2019-02-12T14:25:56.000Z","updated_at":"2023-09-08T17:50:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9959561-b652-4786-9bbf-a78ba4004a3d","html_url":"https://github.com/natemoo-re/gamepad","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"6b68798fba260f3ecff6fbfa3429b56570510483"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/natemoo-re/gamepad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natemoo-re%2Fgamepad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natemoo-re%2Fgamepad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natemoo-re%2Fgamepad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natemoo-re%2Fgamepad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natemoo-re","download_url":"https://codeload.github.com/natemoo-re/gamepad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natemoo-re%2Fgamepad/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265156508,"owners_count":23719734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["controller","gamepad","gamepad-api","gamepad-controller"],"created_at":"2024-10-01T15:09:25.064Z","updated_at":"2025-07-13T14:36:55.104Z","avatar_url":"https://github.com/natemoo-re.png","language":"TypeScript","funding_links":["https://github.com/sponsors/natemoo-re"],"categories":[],"sub_categories":[],"readme":"# 🕹 Gamepad\n\nThe goal of Gamepad is to provide normalized behavior and a higher-level API for interacting with the web's [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API).\n\nUsing a plugin-based architecture, Gamepad provides button and axis mappings for common controllers, allowing you to easily add support for any subset of controllers.\n\n## Installation\n\n- CDN global utility via https://unpkg.com/@gamepad/core\n- ESM via `import { GamepadEventEmitter } from '@gamepad/core'`\n- CJS via `const { GamepadEventEmitter } = require('@gamepad/core')`\n\n## Examples\n\n**Simple**\nBy default, `@gamepad/core` supports any controller with a [`standard`](https://w3c.github.io/gamepad/#remapping) mapping defined on the `Gamepad.mapping` property.\n\n```js\nimport { GamepadEventEmitter } from '@gamepad/core';\n\nnew GamepadEventEmitter();\n\nwindow.addEventListener('gamepadbuttondown', (event) =\u003e {\n    // The value of the button pressed, considering controller layout\n    // Similar to `KeyboardEvent.key`\n    console.log(event.detail.button);\n\n    // The physical button pressed\n    // Similar to `KeyboardEvent.code`\n    console.log(event.detail.code);\n})\n```\n\n**Plugins**\nWithout a `standard` controller mapping, `@gamepad/core` can support any controller using a plugin to map the controller's buttons and axes. Here's an example using `@gamepad/plugin-joycon`.\n\n```js\nimport { GamepadEventEmitter } from '@gamepad/core';\nimport joycon from '@gamepad/plugin-joycon';\n\nnew GamepadEventEmitter({\n    plugins: [\n        joycon()\n    ]\n});\n\nwindow.addEventListener('gamepadbuttondown', (event) =\u003e {\n    console.log(event.detail.button);\n    console.log(event.detail.code);\n})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatemoo-re%2Fgamepad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatemoo-re%2Fgamepad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatemoo-re%2Fgamepad/lists"}