1.9.3 • Published 3 years ago

az-keyboard-man-vue v1.9.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Az-keyboard-man-vue

A simple keyboard event listener for Vue

Usage

Modifiers

ctrl/shift/meta/alt
import AzKeyboardMan from 'az-keyboard-man-vue'
Vue.use(AzKeyboardMan)
export default {
  created() {
    this.$onKeydown(this.handleKeydown, 'KEY_F1') // use with keyName, you can find all keyNames in /src/keyCode.js
    this.$onKeydown(this.handleKeydown, 112, {}, 1, 2) // use with keyCode and two parameters are passed to the function
    this.$onKeydown(this.handleKeydown, 'KEY_F2', {
      modifiers: 'ctrl', // ['ctrl','shift','meta','alt'], default:''
      delay: 1000, // default:500
      delayType: 'debounce', // ['throttle','debounce',null], default:'throttle'
      immediate: false, // default:true
      // el: this.$el // A html element
    })

    this.$onKeyup(this.handleKeyup, 'KEY_F1')
    this.$onKeyup(this.handleKeyup, 112)
    this.$onKeyup(this.handleKeyup, 'KEY_F2', {
      modifiers: 'ctrl,shift',
    })

    var i = this.$onKeyup(this.handleKeyup, 'KEY_F2')
    this.$onKeyRemove(i) // remove this listener
  },
  methods: {
    handleKeydown(e, a, b) {
      console.log('down')
      console.log(e, a, b)
    },
    handleKeyup(e) {
      console.log('up')
      console.log(e)
    },
  },
}

Installation

npm install az-keyboard-man-vue

or

yarn add az-keyboard-man-vue
1.9.3

3 years ago

1.8.2

3 years ago

1.9.0

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.8.20

3 years ago

1.8.21

3 years ago

1.8.9

3 years ago

1.8.10

3 years ago

1.8.8

3 years ago

1.8.11

3 years ago

1.8.7

3 years ago

1.8.12

3 years ago

1.8.6

3 years ago

1.8.13

3 years ago

1.8.5

3 years ago

1.8.14

3 years ago

1.9.2

3 years ago

1.8.15

3 years ago

1.8.3

3 years ago

1.8.16

3 years ago

1.8.17

3 years ago

1.8.18

3 years ago

1.8.19

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.7.4

3 years ago

1.6.17

4 years ago

1.6.14

4 years ago

1.6.11

4 years ago

1.6.10

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.13

4 years ago

1.5.9

4 years ago

1.5.7

4 years ago

1.5.6

4 years ago

1.5.5

4 years ago

1.5.0

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago