I need to store Storageselectedclient even after client logout from my website so that when we logins again the last selected clients will shown up but it's not working also my whole project is in Angular 7.
Here is my working code which has also Idle logout feature in it
var IDLE_TIMEOUT = 10; //seconds
var _idleSecondsCounter = 0;
document.onclick = function () {
_idleSecondsCounter = 0;
};
document.onmousemove = function () {
_idleSecondsCounter = 0;
};
document.onkeypress = function () {
_idleSecondsCounter = 0;
};
$(window).on('hashchange', function(e){
_idleSecondsCounter = 0;
});
window.setInterval(CheckIdleTime, 1000);
function CheckIdleTime() {
_idleSecondsCounter++;
var oPanel = document.getElementById("SecondsUntilExpire");
if (oPanel)
oPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + "";
if (_idleSecondsCounter >= IDLE_TIMEOUT) {
localStorage.clear();
window.location.replace(location.origin);
}
}

localStorage.removeItem('item-key'), for more info => developer.mozilla.org/en-US/docs/Web/API/Window/localStorage