Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { WindowRefService } from './window-ref.service';
import { Idle } from 'idlejs/dist';
import { CanDeactivateGuard } from './shared/guards/can-deactivate-gaurd';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit, OnDestroy {
title = 'Attachment Reetrieval System';
hidden = true;
subscription: Subscription;
constructor(
private router: Router,
private windowRef: WindowRefService,
private canDeactivateGuard: CanDeactivateGuard
) {}
ngOnInit() {
const events = ['click', 'keydown'];
const idle2 = new Idle().stop().whenNot({events: events, target: document});
idle2.within(15).do(() => {
this.hidden = false;
}).start();
const idle = new Idle().stop().whenNot({events: events, target: document})
.within(920, 1000)
.do(() => {
// Time is up
if (this.router.url !== '/') {
// Not already at login page
if (
this.router.url === '/rfaiAdmin' ||
this.router.url === '/rfaiAdmin/payerInfo' ||
this.router.url === '/rfaiAdmin/emailNotifications'
) {
// Deactivate modal guard, so we can navigate back to the login
this.canDeactivateGuard.setInactive();
}
this.router.navigate(['']);
sessionStorage.clear();
this.hidden = true;
}
})
.start(); // start timing
this.subscription = this.router.events.subscribe(event => {
if (!(event instanceof NavigationEnd)) {
return;
}
this.windowRef.nativeWindow.scrollTo(0, 0);
});
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
}