Skip to content

Commit e947d5b

Browse files
authored
Plugin Source
1 parent b679c9c commit e947d5b

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

jquery-sessionTimeoutManager.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,23 @@ var opts;
2828

2929
this.initialize = function () {
3030
console.info("Plugin Initialised");
31-
console.info( "'" + opts.confirmColor + "'");
31+
console.info("'" + opts.confirmColor + "'");
3232
console.log(opts.redirectToURL);
3333
timeoutInterval = Math.floor(opts.sessionActualTimeout - opts.warnUserBeforeDuration);
3434
thisInterval = Math.floor(timeoutInterval / 1000 / 60) + "Minute(s)";
3535

3636
console.log("opts.elementToHook: " + opts.elementToHook);
3737
if (opts.elementToHook === document) {
38-
document.addEventListener("mousemove", this.resetTimer);
38+
document.addEventListener("mousemove", this.resetTimer());
3939
} else {
40-
document.getElementById(opts.elementToHook).addEventListener("mousemove", this.resetTimer);
40+
document.getElementById(opts.elementToHook).addEventListener("mousemove", this.resetTimer());
4141
}
4242

4343
this.startTimer();
4444

4545
return this;
4646
};
4747

48-
this.stopTimer = function () {
49-
50-
clearTimeout(tmrSTM);
51-
console.log("Timeout Stopped");
52-
};
53-
54-
this.resetTimer = function () {
55-
clearTimeout(tmrSTM);
56-
this.startTimer();
57-
console.log("Timeout Reset");
58-
};
59-
6048
this.startTimer = function () {
6149

6250
tmrSTM = setTimeout(function () {
@@ -84,14 +72,27 @@ var opts;
8472
}
8573
});
8674

87-
}else{
75+
} else {
8876
document.location.href = opts.redirectToURL;
8977
}
9078

9179
}, timeoutInterval);
9280
//console.log("Timer Started");
9381
};
9482

83+
this.stopTimer = function () {
84+
85+
clearTimeout(tmrSTM);
86+
console.log("Timeout Stopped");
87+
};
88+
89+
this.resetTimer = function () {
90+
clearTimeout(tmrSTM);
91+
this.startTimer();
92+
console.log("Timeout Reset");
93+
};
94+
95+
9596
return this.initialize();
9697
};
9798

@@ -111,7 +112,7 @@ var opts;
111112
cancelButtonText: '<i class="fas fa-times-circle"></i>&nbsp;Log Out',
112113
confirmAction: function () {
113114

114-
this.resetTimer;
115+
this.resetTimer();
115116

116117
},
117118
cancelAction: function () {

0 commit comments

Comments
 (0)