INNER CODE UNIT · JavaScript
SessionKeepAlive
Keyfactor/signserver-ce · signserver/modules/SignServer-war/src/main/webapp/resources/community/js/ejbca-common.js:138
function SessionKeepAlive(linkElementId) {
var instance = this;
this.timeToNextCheckInMs = 100; // Make first check after 100 ms.
this.xmlHttpReq = new XMLHttpRequest();
var linkComponent = document.getElementById(linkElementId);
if (linkComponent) {
this.link = linkComponent.getAttribute("href");
}
this.xmlHttpReq.onreadystatechange = function() {
if (instance.xmlHttpReq.readyState == 4) {
if (instance.xmlHttpReq.status == 200) {
instance.timeToNextCheckInMs = instance.xmlHttpReq.responseText;
window.setTimeout(instance.poll, instance.timeToNextCheckInMs);
} else {
console.log("SessionKeepAlive failed with HTTP status code " + instance.xmlHttpReq.status);
}
}
};