2.0.0-beta.5 • Published 5 years ago

vue-gamepad v2.0.0-beta.5

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

A Vue.js plugin to add gamepad support. Bind any element to trigger a callback when a gamepad button is pressed.

Installation

npm/yarn

$ npm install vue-gamepad
# or with yarn
$ yarn add vue-gamepad

CDN

https://unpkg.com/vue-gamepad/dist/vue-gamepad.min.js

Usage

Tell Vue to use the plugin

import { createApp } from 'vue';
import VueGamepad from 'vue-gamepad';

const app = createApp(...);
app.use(VueGamepad);

Example usage inside templates:

<button v-gamepad:button-a="callback">Press me!</button>

See Examples for more.

Constructor Options

KeyDescriptionDefaultType
analogThresholdThreshold before analog events are triggered. Low values may cause false positives0.5Number
buttonMappingList of strings containing button indicesMappingArray
buttonInitialTimeoutTime (in milliseconds) until the button will start repeating when held down200Number
buttonRepeatTimeoutTime (in milliseconds) between each button repeat event when held down200Number
injectClassesAdd classes to elements which have a gamepad bindingtrueBoolean
classPrefixString which will be prefixed to all injected classesv-gamepadString

Directives

  • v-gamepad - Bind an element to a gamepad action which will fire a callback
    • released modifier - Only fire the callback when the button is released
    • repeat modifier - Repeatedly fire the callback when the button is held
  • v-gamepad-layer - Bind gamepad actions to different layers (See Examples)

License

This project is licensed under the MIT License - see the LICENSE file for details

2.0.0-beta.6

5 years ago

2.0.0-beta.5

5 years ago

2.0.0-beta.4

5 years ago

2.0.0-beta.3

5 years ago

2.0.0-beta.2

5 years ago

2.0.0-beta.1

5 years ago

2.0.0-beta.0

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago