on 08-26-2022 7:27 AM
Hi guys,
I am facing one issue for the session timeout. I want to control the session time to if i switched the tab or minimize the browser. I have written a code to calculate the session but if i switched the tab, the timeout call back function is not working after 2-3 hit and then again start working if i came back to tab.
handleSession:function()
{
var sessionExpiry = parseInt(10);
var oThis = this;
var currentTime = new Date();
var lastAccess = this.oApp.getDataProvider().SERVICE.getSessionTime();
var diffMs = (currentTime - lastAccess); // Milliseconds
var diffMins= Math.floor((diffMs/1000)/60);
if (!that.oSessionDialog)
{
try
{
that.oSessionDialog = sap.ui.xmlfragment("sap.umc.mobile.private.app.view.SessionOut", this);
that.getView().addDependent(oThis.oSessionDialog);
}
catch(ex)
{
return;
}
}
if (diffMins >= sessionExpiry)
{
if(that.oSessionDialog.isOpen() == false)
{
that.oSessionDialog.open();
oThis.nTimer = 90;
}
oThis.setInterval(1);
}
else
{
setTimeout(function()
{
oThis.handleSession()
},100);
}
},
This is the code i have used for as of now. setTimeout will work properly if i stayed on the same tab, but if i switched or minimize the browser, it stopped working after few trigger.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.