when user click element it should initiate the timeout and set the starttime to true. Then if user clicks element again while the timer is active it should clear the timeout and reinitiate the timeout. However im still getting the console from the first and the following timeout initiated. Shouldnt the cleartimeout leave me with only one, the final one created? Ive already tried the example from this question here How to reset timeout in Javascript/jQuery?.
toggleCard: function(card){
var Timer = null;
if(this.startTime){
console.log('already activated');
window.clearTimeout(Timer);
this.startTime = false;
}
this.startTime = true;
var Timer = setTimeout(function(){
// this.taskCard = false;
// this.classCard = true;
console.log('old timer')
}.bind(this), 5000);