setTimeout() and setInterval() functions allow you to execute a piece of JavaScript code/function at a certain point in the future. setInterval repeats the call, setTimeout only runs it once.
JavaScript setTimeout(expression, timeout); runs the code/function once after the timeout. It is a time based code execution method that will execute script only one time when the interval is reached, and not repeat again unless you gear it to loop the script by nesting the setTimeout object inside of the function it calls to run. If geared to loop, it will keep firing at the interval unless you call clearTimeout(). If you want something to happen one time after some seconds Then use setTimeout... because it only executes one time when the interval is reached.
setTimeout(function() {
console.log('Wait 3 seconds and I appear just once');
}, 3000);
setInterval(expression, timeout); runs the code/function repeatedly, with the length of the timeout between each repeat. It is a time interval based code execution method that has the native ability to repeatedly run specified script when the interval is reached. It should not be nested into its callback function by the script author to make it loop, since it loops by default. It will keep firing at the interval unless you call clearInterval(). If you want to loop code for animations or clocks Then use setInterval.
setInterval(function() {
console.log('Every 3 seconds I appear on your console');
}, 3000)
------------------------------
tony gruz
MFC
------------------------------
Original Message:
Sent: Feb 07, 2019 09:50 AM
From: Rex Kenley Tan
Subject: Auto Refresh
Tristan
1.) Is there a way to auto refresh a page after a certain amount of time?
Yes, but I don't recommend it.
https://www.w3schools.com/jsref/met_win_settimeout.asp
2.) I'm look to have the page refresh after the stage is moved in the background
It might be better to use a progress bar, especially if you don't want the user to do anything else until the background process is done.
I would display the progress bar to "lock" the screen and initiate an async call that queries the stage. Once I get a response back, that would trigger the page to refresh.
Cheers!
------------------------------
Rex Kenley Tan, MCP
Akron OH
https://www.youracclaim.com/users/rex-kenley-tan
*Always be CURRENT with JavaScript & C#, NEVER be obsolete.
DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
Original Message:
Sent: 02-06-2019 11:58 AM
From: Tristan Holt
Subject: Auto Refresh
Is there a way to auto refresh a page after a certain amount of time? I current have business process that starts from an entity record, steps two moves to an activity record with the regarding set as the original entity, and then when that activity is complete, the business process takes you back to the regarding but does not "visually" move the business process bar to the next stage. In the background, the stage is moved, but you have to refresh the page. I'm look to have the page refresh after the stage is moved in the background or maybe have an alert the doesn't show a "move forward" button until the background process takes place, so you won't have to refresh.
------------------------------
Tristan Holt
CRM Administrator
StoneMor Partners
Trevose PA
------------------------------