Timer Javascript

Timer Javascript


I have two questions for one problem.

1.Is there any way to run a timer of X in X seconds instead of minutes??
2.I have two functions in javascript onLoad () and OnUnload () which returns the time in seconds that the user this page, the problem is how to write it in a variable in Outsystems ... ?? in attach there is an example attached to see who can help me.

Best regards
Daniel Maia
Hi Daniel,

Regarding your second question you could create a page to store that value and use a javascript function like this:

function SaveTime(val) {
 var request = null;
 try {
	request = new ActiveXObject("Msxml2.XMLHTTP") }
 catch(e) {
   try  {
		request = new ActiveXObject("Microsoft.XMLHTTP")  }
   catch(oc)  {
       request = null  }
 if(!r && typeof XMLHttpRequest != "undefined") {
	request = new XMLHttpRequest() }
 if (request) {
  request.open("GET", "YourLogPage.aspx?Time=" + val, true);

Tiago Simões

Hello Daniel,

About your second question I came up with a different solution to the one proposed by Tiago, I'm suggesting it only because I think its simpler and it uses your original javascript code with a minor alteration.
I already use something similar to this to get values out of webblocks.

See if you like it and if you have any doubts just ask.

Best regards,
Hermínio Mira
Hello everyone,

Thanks for replying to my question, I think the solution of Hermínio Mira
is simple and easy to implement for what I want to do ...

Best Regards
Daniel Maia

Hi Daniel,

Regarding your first question. If you're talking about Scheduler Timers, although you can indicate a timer to run in a particular it will not start at the date-time you specify. You can read more about timers in this technical note.

An easy way to run a timer action in a particular date-time is to set it to run a few minutes earlier and perform a sleep of the exact time so the next action can start exactly when you pretend.

hope that this can be useful.

João Portela