A Vue.js plugin to add gamepad support. Bind any element to trigger a callback when a gamepad button is pressed.
$ npm install vue-gamepad
# or with yarn
$ yarn add vue-gamepad
https://unpkg.com/vue-gamepad/dist/vue-gamepad.min.js
Tell Vue to use the plugin
import Vue from 'vue';
import VueGamepad from 'vue-gamepad';
Vue.use(VueGamepad);
Example usage inside templates:
<button v-gamepad:button-a="callback">Press me!</button>
Key | Description | Default | Type |
---|---|---|---|
analogThreshold |
Threshold before analog events are triggered. Low values may cause false positives | 0.5 |
Number |
buttonMapping |
List of strings containing button indices | Mapping | Array |
buttonInitialTimeout |
Time (in milliseconds) until the button will start repeating when held down | 200 |
Number |
buttonRepeatTimeout |
Time (in milliseconds) between each button repeat event when held down | 200 |
Number |
injectClasses |
Add classes to elements which have a gamepad binding | true |
Boolean |
v-gamepad
- Bind an element to a gamepad action which will fire a callbackreleased
modifier - Only fire the callback when the button is releasedrepeat
modifier - Repeatedly fire the callback when the button is held
v-gamepad-layer
- TODOv-gamepad-json
- Pass a raw object of buttons, actions and callbacks to bind
This project is licensed under the MIT License - see the LICENSE file for details