Created
March 19, 2012 19:05
-
-
Save JDMcKinstry/2124294 to your computer and use it in GitHub Desktop.
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
// Again, what you name the function is clearly up to you, I wouldn't really recommend my example name as it is just plain bad :P | |
function stopType() { | |
// The following if statement will check if your timer has been assigned yet, and if so, clears it so it will no longer continue to your work function | |
if (tmrStopType!= undefined) clearTimeout(tmrStopType); | |
// The following will attempt to start your work function after 2 seconds unless interrupted and reset by previous if statement | |
// Also, many people would rather write this statement as tmrStopType= setTimeout(stopTypeWork(), 2000); | |
// If, you want to, that is fine, i don't because it is not a style of timer writing that is readable to ALL browsers, however, the following is | |
tmrStopType= setTimeout(function (){ stopTypeWork() }, 2000); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment