Skip to content

Commit 3e87f46

Browse files
Bharat SinhaBharat Sinha
Bharat Sinha
authored and
Bharat Sinha
committed
Added Comments and Added Missing Counter Variable initialization
1 parent 4ff3f6e commit 3e87f46

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

timout.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
ageTime = setInterval(function() {
1+
//Initialize the Count or Time in sec equals to zero
2+
var count = 0;
3+
4+
//Assign SetInterval to a variable
5+
PageTime = setInterval(function() {
6+
//Increament Count on Each Interval Call i.e. Each Second
27
count += 1;
8+
//If Time is Greater than 20 sec Load the Timeout Page : Change time as per need
39
if (count === 20) {
10+
//code to clear the interval
411
clearInterval(pageTime);
12+
//Insert the HTML here which will be painted after timeout is encountered
513
document.write("Code FOr Page To Be Displayed Here");
614
}
715
}, 1000);
16+
17+
//This determines the state of the entire document
818
document.onreadystatechange = function() {
19+
//Here we selected Interactive event to encounter the Timeout
20+
//Load Time or DOM content loaded time can also be used
921
if (document.readyState === 'interactive') {
1022
clearInterval(pageTime);
1123
}
1224
}
1325

14-
function reloadIM() {
15-
_gaq.push(['_trackPageview', '/IMartEvents/Timeout/Refresh' + document.location.pathname]);
26+
//Function to reload the page can be call using the HTML inserted by document.write
27+
//Can be call on an onclick event of a buttom
28+
function reloadPage() {
1629
location.reload();
1730
}

0 commit comments

Comments
 (0)