Skip to content
This repository was archived by the owner on Apr 12, 2023. It is now read-only.

netsells/vue-set-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5