Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qquanwei/vue-event-debounce
vue-plugin: block event when callback is pedding!
https://github.com/qquanwei/vue-event-debounce
Last synced: 14 days ago
JSON representation
vue-plugin: block event when callback is pedding!
- Host: GitHub
- URL: https://github.com/qquanwei/vue-event-debounce
- Owner: Qquanwei
- Created: 2017-04-13T09:13:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-06T01:45:23.000Z (over 6 years ago)
- Last Synced: 2024-08-09T22:35:10.092Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/Qquanwei/vue-event-debounce.svg?branch=master)](https://travis-ci.org/Qquanwei/vue-event-debounce)
[![npm](https://img.shields.io/npm/v/vue-event-debounce.svg)](https://www.npmjs.com/package/vue-event-debounce)# vue-event-debounce
Support TypeScript!
Block event when callback is pedding! autoresolve Promise/generator.
blog: http://quanweili.com/2017/10/27/introduce-vue-event-debounce.html
## Install
`npm install vue-event-debounce --save`
## Usag
```
...
import VED from 'vue-event-debounce'Vue.use(VED, { events: ['click'] })
...
```and then, in component we can using a bounce event for click!
```
click me
export default {
...
methods: {
myclick (e) {
// this is may be a ajax request, or just simple function
return new Promise(function (resolve) {
setTimeout(resolve.bind(this, 0), 3000)
})
}
}
...
}```
## Options
* `events`: array , directive name and event name.
`Vue.use(VED, { events: ['click', 'keydown', 'keyup']})`
will be bind directive `v-click` `v-keydown` `v-keyup` to Vue.