Link to home
Start Free TrialLog in
Avatar of Relegence
RelegenceFlag for Israel

asked on

window intervals

Hello,

Is it possible to know the number of active intervals in a window?

Thanks,
Dana
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

When you setInterval, stack them in an array. array.length will give you number of active inetervals.

You need to write your code for managing these.

var myint = new Array();

myint[0] =window.setInterval ("func1()", 1000);
myint[1] =window.setInterval ("func2()", 1000);

alert (myint.length);
Avatar of Relegence

ASKER

I did that but i'm not sure it can help me.
My page can display different types of data. For each type i want to clear the previous set of intervals and create new ones.
I am doing that by saving the intervals names in an array, as suggested, so that after every change of data i clear the previous intervals and create new ones.
Since the performence of the page is not so good, i have a feeling that this mechanism doesn't work so well. To make sure, i thought i would popup an alert with the number of active intervals.
Is that possible?

Thanks you,
Dana
ASKER CERTIFIED SOLUTION
Avatar of shaggy_the_sheep
shaggy_the_sheep

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shaggy_the_sheep
shaggy_the_sheep

yep that would do it aswell...a tad easier as well! lol