Skip to content Skip to sidebar Skip to footer

How To Use Cleartimeout

I am new to javascript and Meteor and trying to clearTimeout on a function of a function. The console states cannot find property of. I did not write the code so I am at a loss of

Solution 1:

// define myTimeout somewhere globally
var myTimeout;

function instance() {
    ...
    myTimeout = setTimeout(instance, 100);
}

function stop() {
     clearTimeout(myTimeout);
}

Post a Comment for "How To Use Cleartimeout"