Page 1 of 3

Timer

Posted: Wed Dec 07, 2011 4:05 am
by Brad

Is there a way to call a service at specific intervals?

If not, I guess a Javascript timer would be ok to use, but then how to call the service to run?

Thanks..


Timer

Posted: Wed Dec 07, 2011 6:25 am
by maxkatz

Yes, custom JavaScript timer is one way to go. Let me find whether possible and/or how to call a service from JavaScript


Timer

Posted: Thu Dec 08, 2011 1:40 am
by maxkatz

Try this:
setTimeout( "restdatasource01.execute({})" , 5000);

where 'restdatasource01' is the name of the service


Timer

Posted: Fri Dec 09, 2011 6:13 am
by Brad

Max,

Yes, I managed to create a timer from script that works until cancelled. I noticed that when the service runs, the entire screen develops a grey overlay with a busy icon until finished, like it's working without freeing the current thread.

Is there a way to avoid this?


Timer

Posted: Fri Dec 09, 2011 6:07 pm
by maxkatz

Yes, that's an Ajax status indicator - to let you know that's something is happening. You want to disable it?


Timer

Posted: Sat Dec 10, 2011 12:33 am
by Brad

Yes, the application I 'm working on needs to run 24/7 in the background, updating at set intervals. The screen would interfere with the other phone/user functions. So, I guess my next question is, how to keep running our applications after exit, in this situation the screen should not turn grey or show Ajax update icon when accessing services.


Timer

Posted: Sat Dec 10, 2011 1:01 am
by maxkatz

Use this on page load: $('#ajaxBusy').remove();


Timer

Posted: Sat Dec 10, 2011 12:52 pm
by Brad

That worked perfectly! Again thanks!


Timer

Posted: Thu Mar 14, 2013 5:25 pm
by Jonathan Clark

I was looking for the same thing and tried this solution, but later found:

var mytimedfunc=setInterval("javascript function",milliseconds);

which automatically runs the event everyXseconds as opposed to once after timeout. I like this a bit better because it's really easy to just add:

clearInterval(mytimedfunc);

on "beforeUnload". Don't know if this is useful to anyone but just thought I would add to the discussion.


Timer

Posted: Thu Mar 14, 2013 5:39 pm
by Kateryna Grynko

Jonathan, thank you for sharing this.