1.0.0 • Published 4 years ago

v-scheduled v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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