raix:onetimeout
Onetimeout will run only the latest used function.
1 var myTimeout = new OneTimeout(500); // Delay 500ms 2 3 var runMeOnce = function() { 4 console.log('I just ran!'); 5 }; 6 7 myTimeout(runMeOnce); 8 myTimeout(runMeOnce); // Replace last function 9 myTimeout(runMeOnce); 10 myTimeout(runMeOnce); 11 myTimeout(runMeOnce); 12 myTimeout(runMeOnce); 13 myTimeout(runMeOnce); // Counts 500ms from here... 14 15 // console 16 // : I just ran!
Kind regards
Morten (aka RaiX)