Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@netsells/vue-set-timeout

netsells489ISC0.1.5

Use setTimeout and setInterval safely in Vue

readme

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);
    },
}