vue-gamepad

A Vue.js plugin to add gamepad support.
1,166 20
Install
npm install vue-gamepad
Latest Version:1.1.1
Vue:2
License:MIT
Last Updated:Jan 6, 2023
Links: GitHub  ·  npm
Maintainer: aaronlad

Vue Gamepad logo

vue-gamepad

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 Vue from 'vue';
import VueGamepad from 'vue-gamepad';

Vue.use(VueGamepad);

Example usage inside templates:

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

Constructor Options

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

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 - TODO
  • v-gamepad-json - Pass a raw object of buttons, actions and callbacks to bind

License

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

Related Packages

vue-full-screen-file-drop

Vue component for full screen file drop

16,061 19
bxs-ui-vue

BSX Components

3,870
@~crazy/watcher

对象观察者

1,049
vue-cookies-ts

A simple Vue.js plugin for handling browser cookies

41,932 3
gitee-ent

A component library for Gitee Enterprise

17,708

Version History

Version Released Vue License
1.1.1 ^2.6.11 MIT
1.1.0 ^2.5.17 MIT
1.0.1 ^2.5.17 MIT
1.0.0 ^2.5.17 MIT
Pre-releases (6)
Version Released Vue License
2.0.0-beta.6 ^3.0.0-rc.11 MIT
2.0.0-beta.5 ^3.0.0-beta.15 MIT
2.0.0-beta.4 ^3.0.0-beta.14 MIT
2.0.0-beta.3 ^3.0.0-beta.14 MIT
2.0.0-beta.1 ^3.0.0-beta.14 MIT