Skip to Content
0
Mar 25, 2019 at 10:31 PM

Timeout script not consistent

97 Views

Hi,

I have an issue. I added script to timeout for 20sec(for testing, actual timeout is 15min). the script is not consistent. sometimes it is triggering, sometimes not. This script is added under "ENTER" screen event. what is the issue. Please suggest the solution.

var timeout = null;

window.document.body.onkeypress = function(event) {

// Clear the timeout to prevent the previous task from executing

window.clearTimeout(timeout);

// Do session timeout code here: Only runs if

// inactive for more than specified MS

timeout = window.setTimeout(function () {

session.utils.log("Session timed out!");

session.utils.showOptionDialog("My Dialog", "Session expired! closing the form", session.utils.MESSAGE_TYPE_INFORMATION, //session.utils.MESSAGE_OPTION_OKCANCEL, session.utils.MESSAGE_OPTION_OK, onOptionDialogClose, "1"); }, 20000); };

function onOptionDialogClose(decision, ID)

{ session.findById("wnd[0]/tbar[0]/okcd").text = "/nex"; session.findById("wnd[0]").sendVKey(0); }