0.1.0 • Published 4 years ago

vue-use-countdown v0.1.0

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

vue-use-countdown

A mixin that provides countdown timer functionality.

Displays time remaining and executes callback when time elapsed

Usage

<template>
  <div id="app">
    {{countdown.remainingTime}}
    <button @click="this.stopCounting">stop</button>
    <button @click="this.startCounting">start</button>
  </div>
</template>

<script >
import Vue from "vue";
import useCountdown from "vue-use-countdown";
export default Vue.extend({
  methods: {
    startCounting() {
      const countdownPeriod = 30;
      this.startCountdown(() => console.log('tick'), countdownPeriod);
    },
    stopCounting() {
      this.stopCountdown()
    }
  },
  mixins: [useCountdown]
});
</script>
0.1.0

4 years ago

0.0.1

4 years ago