0.1.1 • Published 6 years ago

vue-event-debounce v0.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Build Status npm

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/

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!

<template>
  <button v-click="myclick">click me</button>
</template>


<script>
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)
      })
    }
  }
  ...
}
</script>

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.

0.1.1

6 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago