stopping a function if called within 5 sec again in typescript or javascrit
stopContent = false;
getFeed(){
if(this.stopContent == false){
/* stop more on next click */
this.stopContent = true;
/* allow more feeds after 5 sec */
setTimeout(e=>{ this.stopContent = false;}, 5000);
console.log(‘feeding’);
/* your code here */
}else{
console.log(‘stopping’);
}
}