vue-global-events
Listen to events on the document anywhere
Installation
npm install vue-global-events
Usage
import GlobalEvents from 'vue-global-events'
// register globally
Vue.component(GlobalEvents)
// or locally
export default {
components: { GlobalEvents },
// rest of your component
}
After that you can register global events like this:
<GlobalEvents
v-if="listenersConnected"
@keyup.ctrl.tab="nextTab"
@keyup.ctrl.shift.tab="previousTab"
@keyup.space="pause"
@contextmenu="openMenu"
/>
Development
Run tests in watch mode:
npm run dev
Demo
Just use poi
# if not yet installed
npm i -g poi
poi index.js
Authors:
Damian Dulisz @shentao
Eduardo San Martin Morote @posva