Solved

javascript timer "locks up" the web page

Posted on 2014-10-14
9
145 Views
Last Modified: 2014-10-16
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.
0
Comment
Question by:dhenderson12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 40380234
How are you fetching events outside the browser?
0
 

Author Comment

by:dhenderson12
ID: 40380421
the dll has a function called "FetchEvents()".  so the object is:
 <object classid="clsid:55527FAD-5E60-4F44-867B-9F6E7B0DB9DD" id="ica">
        </object>

and the call is form1.ica.FetchEvents();
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 40380779
Are you doing something like this

setInterval('fetchEvents()', 1000);

function fetcEvents()
{
   // Make your call to the object here.
}

Open in new window


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?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:dhenderson12
ID: 40380857
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.
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 40380964
It shouldn't - that is why I asked the question

What is your timeout
How long does it take for the call to the DLL to complete (in FetchEvents)

If your timeout is smaller than the time taken to process the call to the dll then that could cause the problem.
0
 

Author Comment

by:dhenderson12
ID: 40384163
I increased the timeout to 60000 (60 seconds) but that didn't help.
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 40384199
It would help if there was a link or some code to look at - can you post your javascript implementation
0
 

Author Comment

by:dhenderson12
ID: 40385419
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.
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 40386089
Well that would do it - refer my comment earlier

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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question