warning
netsells/no-global-timeoutsPrevent setTimeout and related functions being used in Vue components
Examples
❌ Incorrect
<script>
export default {
mounted() {
setTimeout(this.handleTimeout, 1000);
},
methods: {
handleTimeout() {
// handle
},
},
};
</script>
✅ Correct
<script>
import VueSetTimeout from '@netsells/vue-set-timeout';
export default {
mixins: [VueSetTimeout],
mounted() {
this.setTimeout(this.handleTimeout, 1000);
},
methods: {
handleTimeout() {
// handle
},
},
};
</script>