james henderson
asked on
javascript timer "locks up" the web page
i have a dll that raises events. i have a javascript function event handler. this works well, as long as I call a function in the dll to return the event. but there are events that happen outside the browser that I need to respond to. I created a javascript timer to fetch the events, but that won't let the page respond to button clicks, text box entry, etc.
how can i implement this so that the page stays responsive? i am using straight javascript and html, the dll is loaded on the page as an embedded object.
how can i implement this so that the page stays responsive? i am using straight javascript and html, the dll is loaded on the page as an embedded object.
How are you fetching events outside the browser?
ASKER
the dll has a function called "FetchEvents()". so the object is:
<object classid="clsid:55527FAD-5E 60-4F44-86 7B-9F6E7B0 DB9DD" id="ica">
</object>
and the call is form1.ica.FetchEvents();
<object classid="clsid:55527FAD-5E
</object>
and the call is form1.ica.FetchEvents();
Are you doing something like this
And you are saying that is causing the page to not be responsive? Why is that? Does the fetchEvents method take a long time to complete?
How often are you calling it?
setInterval('fetchEvents()', 1000);
function fetcEvents()
{
// Make your call to the object here.
}
And you are saying that is causing the page to not be responsive? Why is that? Does the fetchEvents method take a long time to complete?
How often are you calling it?
ASKER
here's the cycle:
1. page loads and it logs into the object ( form1.ica.init() ) through javascript. (ica is a com dll).
2. there is a javascript event handler at the top of the page, an when init() is called on ica, ica raises an event that is captured by the event handler.
3. if I call another method on the object, like form1.ica.changestate(), i follow that with a call to form1.ica.FetchEvents(), which forces the event to be raised.
i want to put the FetchEvents() method on a javascript timer, but when I do the rest of the page becomes unresponsive.
1. page loads and it logs into the object ( form1.ica.init() ) through javascript. (ica is a com dll).
2. there is a javascript event handler at the top of the page, an when init() is called on ica, ica raises an event that is captured by the event handler.
3. if I call another method on the object, like form1.ica.changestate(), i follow that with a call to form1.ica.FetchEvents(), which forces the event to be raised.
i want to put the FetchEvents() method on a javascript timer, but when I do the rest of the page becomes unresponsive.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I increased the timeout to 60000 (60 seconds) but that didn't help.
It would help if there was a link or some code to look at - can you post your javascript implementation
ASKER
thanks for your help, Julian, but I found a different solution. I created an async version of the method I'm calling and it works like a champ. I appreciate the time and the help.
Well that would do it - refer my comment earlier
Glad you got sorted though - thanks for the points and good luck with your project.
How long does it take for the call to the DLL to complete (in FetchEvents)
Glad you got sorted though - thanks for the points and good luck with your project.