2021-08-27 13:39:52 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { SessionStore } from '../store/session.service';
|
|
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
|
|
|
|
export class InativityService {
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private router: Router,
|
|
|
|
|
) {
|
|
|
|
|
|
2023-01-04 14:45:17 +01:00
|
|
|
// var time;
|
|
|
|
|
// window.onload = resetTimer;
|
|
|
|
|
// window.onmousemove = resetTimer;
|
|
|
|
|
// window.onmousedown = resetTimer; // catches touchscreen presses as well
|
|
|
|
|
// window.ontouchstart = resetTimer; // catches touchscreen swipes as well
|
|
|
|
|
// window.onclick = resetTimer; // catches touchpad clicks as well
|
|
|
|
|
// window.onkeydown = resetTimer;
|
|
|
|
|
// window.addEventListener('scroll', resetTimer, true); // improved; see comments
|
2021-08-27 13:39:52 +01:00
|
|
|
|
2023-01-04 14:45:17 +01:00
|
|
|
// function userIsNotActive() {
|
|
|
|
|
// // your function for too long inactivity goes here
|
|
|
|
|
// // SessionStore.setInativity(false)
|
|
|
|
|
// // alert('go out')
|
|
|
|
|
// try {
|
|
|
|
|
// // window['inactivity/function']()
|
|
|
|
|
// } catch (error) {}
|
2023-01-02 14:36:57 +01:00
|
|
|
|
2023-01-04 14:45:17 +01:00
|
|
|
// }
|
2021-08-27 13:39:52 +01:00
|
|
|
|
2023-01-04 14:45:17 +01:00
|
|
|
// function resetTimer() {
|
|
|
|
|
// clearTimeout(time);
|
|
|
|
|
// time = setTimeout(userIsNotActive, 60000 * 1); // time is in milliseconds
|
|
|
|
|
// }
|
2021-08-27 13:39:52 +01:00
|
|
|
}
|
|
|
|
|
}
|