Results 1 to 3 of 3
Jun 21, 2007, 06:56 #1
- Join Date
- Apr 2006
- 0 Post(s)
- 0 Thread(s)
setTimeout() calling function that has a return value
Hopefully I am just missing something easy here. I am trying to call a function with the setTimeout, but the function returns a value. How do I get the value returned.
var lesson_status = api.LMSGetValue("cmi.core.lesson_status"); //without a delay
setTimeout(api.LMSGetValue("cmi.core.lesson_status"),2000); //wait 2 seconds then call api.LMSGetValue
What I need is something like:
var lesson_status = setTimeout(api.LMSGetValue("cmi.core.lesson_status"),2000); //lesson_status then contains a reference to the timer
I also tried something like this:
setTimeout(retValue=api.LMSGetValue("cmi.core.lesson_status"),2000); //wait 2 seconds then call api.LMSGetValue and set retValue to its return value
What I need is to call the function LMSGetValue("cmi.core.lesson_status") after a 2 second pause and get its return value.