v-scheduled
v1.0.0
Published
A simple tool to create timers from vue component's methods
Downloads
2
Maintainers
Readme
v-scheduled
A simple tool to create timers from methods in a more declarative way (VUE way)
If you want the component to perform some action repeatedly at some interval try v-scheduled
1. Install:
yarn add v-scheduled // or
2. Require:
import VScheduled from 'v-scheduled';
Vue.use(VScheduled);
or if you wish, you could use mixin and attach it only for some components:
import { mixin } from 'v-scheduled';
export default {
name: 'YourComponent',
mixins: [ mixin() ],
...
};
3. Use in Your Components:
<template>
<span> {{ pingNum }} </span>
</template>
<script>
export default {
data() {
return {
pingNum: 0
};
},
methods: {
ping() {
this.pingNum += 1;
}
},
// this is what you need to add to your code
scheduled: {
ping: 1000
},
};
</script>
todo:
- tests
- examples