Click here to Skip to main content
14,665,426 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all, I'll be so grateful If I could figure out to determine the idle time of javascript setTimeout function, that is, I want to use it in an "if statement" as a condition if idle or not evaluating to a boolean true or false, such as:

 if (setTimeout(iGotTheAnswerByMyself(), 7000000000000) { 
// do something if you get an answer before time is out

Thanks a lot for your efforts in advance!
Dholakiya Ankit 19-Jul-13 23:40pm
but i think if your settimeout once started it can not be sorted or conditioned you have to find something else

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Nice humorous formulation of the question, I appreciate it.

This is about 222 years. I don't think I need to rush with the answer. I hope this time would be enough for you to read JavaScript documentation. The function is so simple that it will be too easy to meet this deadline. And hundreds of times more useful. :-)

Good luck,
OwlCity 20-Jul-13 0:07am
Thanks Sergey, don't make me beg! I'm a newbie to javascript. Thanks!!
No problem, but I'm not just joking. Really, read documentation on this API with attention, it will make it clear. Pay attention: JavaScript is loosely typed, so it will return the result you define in your function, no matter what it is.
OwlCity 20-Jul-13 0:32am
Thanks a lot Sergey! And I equally thank you Dholakiya for your answer and time. All so helpful.
You are welcome. If you, except for explaining some confusion, will also explain your goal, chances are, we will give your more useful help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100