Last active
October 28, 2015 22:04
-
-
Save troutacular/b0b79771d86ebb7c83af to your computer and use it in GitHub Desktop.
JS: Multiple Timeouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TimeOuts | |
* ======== | |
* | |
* Use the functions below to handle mutliple timeouts | |
* | |
* New timeout | |
* timeOuts['ID'] = setTimeout(someFunction('values'), 250); | |
* | |
* Clear specific timeout | |
* clearTimeout(timeOuts['ID']); | |
*/ | |
// array for all timeOuts | |
var timeOuts = []; | |
// clear all timeOuts | |
function clearTimeouts() { | |
'use strict'; | |
for ( var key in timeOuts ) { | |
clearTimeout( timeOuts[key] ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment