Jump to content

timing script events


Xeron

Recommended Posts

I'm trying to delay a part of my code. The part what needs to be delayed for x seconds is is requesting content from a daemon. However the delay cannot cause other part of the script to stop.The part I want to delay is within a function in a try { } statement. only this part needs to be delayed. I tried a setTimeout however the function called 1 line earlier also stops working. The function does not execute fully before the settimeout is triggered.function(1) { callfunction(2); // Delayed codetry{ socket.send(sendcmd); log('sencmd); } }// End delayed code }maybe someone has any idea how to manage this? thanks!!

Link to comment
Share on other sites

im not sure I get what is going wrong for you, I tried some timeouts and none of them interupted each other or stopped the function from completeing

<html><head><script type="text/javascript">function test(){setTimeout(function(){  document.getElementById("delay1").innerHTML = "delay 1..";}, 4000);setTimeout(function(){  document.getElementById("delay2").innerHTML = "delay 2..";}, 3000);document.getElementById("endOfFunction").innerHTML = "function ending...";}</script></head><body onload="test();"><p id="delay1"></p><p id="delay2"></p><p id="endOfFunction"></p></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...