0.1.1 • Published 3 years ago

vue-timing-events v0.1.1

Weekly downloads
2
License
MIT
Repository
-
Last release
3 years ago

Vue Timing Events License Library size Dependencies

Automatically cleans up timers and event listeners on component beforeDestroy

Install

$ npm install -D vue-timing-events

# For Yarn, use the command below.
yarn add vue-timing-events

Usage

import Vue from "vue";
import VueTimingEvents from 'vue-timing-events';

Vue.use(VueTimingEvents);
// Somecomponent.vue
export default {
  created() {
    this.$setInterval(this.doInterval, 2000);
    this.$addEventListener("resize", this.onResize, { passive: true });
  },
  methods: {
    doInterval() {
      console.log("Are we there yet?");
    },
    onResize() {
      console.log("Hey stop triggering so much layout/reflow. :(");
    }
  }
}

License

MIT © Danny Pham