@netsells/vue-set-timeout

0.1.5 • Public • Published

npm version Build Status codecov Mutation testing badge

Vue Set Timeout

A mixin to make it easy to safely use setTimeout, setInterval and clearTimeout in your Vue components without memory leaks

Usage

This mixin adds setTimeout, setInterval and clearInterval to the components class instance. They take the same arguments as the native JS functions, and return the same values.

import VueSetTimeout from '@netsells/vue-set-timeout';

export default {
    mixins: [VueSetTimeout],

    mounted() {
        this.setTimeout(() => {}, 10);
        const timer = this.setInterval(() => {}, 10);
        this.clearTimeout(timer);
    },
}

Readme

Keywords

none

Package Sidebar

Install

npm i @netsells/vue-set-timeout

Weekly Downloads

44

Version

0.1.5

License

ISC

Unpacked Size

16.2 kB

Total Files

12

Last publish

Collaborators

  • rebeccaanderton
  • samturrell
  • spamoom
  • jakub.gawron