Commit 9848d3e6c5d81161b8f7dbacd1988d21e5a48732
1 parent
2652f5c904
Exists in
develop
descomento funcion
Showing
1 changed file
with
1 additions
and
1 deletions
 
Show diff stats
src/app/modules/admin/admin.component.ts
| 1 | import { Component, OnInit, HostListener } from '@angular/core'; | 1 | import { Component, OnInit, HostListener } from '@angular/core'; | 
| 2 | import { Router } from '@angular/router'; | 2 | import { Router } from '@angular/router'; | 
| 3 | 3 | ||
| 4 | @Component({ | 4 | @Component({ | 
| 5 | selector: 'app-admin', | 5 | selector: 'app-admin', | 
| 6 | templateUrl: './admin.component.html', | 6 | templateUrl: './admin.component.html', | 
| 7 | styleUrls: ['./admin.component.scss'] | 7 | styleUrls: ['./admin.component.scss'] | 
| 8 | }) | 8 | }) | 
| 9 | 9 | ||
| 10 | export class AdminComponent implements OnInit { | 10 | export class AdminComponent implements OnInit { | 
| 11 | timerReposo: any; | 11 | timerReposo: any; | 
| 12 | 12 | ||
| 13 | constructor( | 13 | constructor( | 
| 14 | private router: Router, | 14 | private router: Router, | 
| 15 | ) { } | 15 | ) { } | 
| 16 | 16 | ||
| 17 | ngOnInit() { | 17 | ngOnInit() { | 
| 18 | // this.startTimeOutInactividad(); | 18 | this.startTimeOutInactividad(); | 
| 19 | } | 19 | } | 
| 20 | 20 | ||
| 21 | @HostListener('document:click', ['$event']) | 21 | @HostListener('document:click', ['$event']) | 
| 22 | 22 | ||
| 23 | documentClick(event: MouseEvent) { | 23 | documentClick(event: MouseEvent) { | 
| 24 | if (event) { | 24 | if (event) { | 
| 25 | this.restartTimer(); | 25 | this.restartTimer(); | 
| 26 | } | 26 | } | 
| 27 | } | 27 | } | 
| 28 | 28 | ||
| 29 | restartTimer() { | 29 | restartTimer() { | 
| 30 | clearTimeout(this.timerReposo); | 30 | clearTimeout(this.timerReposo); | 
| 31 | this.startTimeOutInactividad(); | 31 | this.startTimeOutInactividad(); | 
| 32 | } | 32 | } | 
| 33 | 33 | ||
| 34 | startTimeOutInactividad() { | 34 | startTimeOutInactividad() { | 
| 35 | this.timerReposo = setTimeout(() => { | 35 | this.timerReposo = setTimeout(() => { | 
| 36 | this.router.navigate(['cancelar-compra']); | 36 | this.router.navigate(['cancelar-compra']); | 
| 37 | }, 90000); | 37 | }, 90000); | 
| 38 | } | 38 | } | 
| 39 | 39 | ||
| 40 | } | 40 | } | 
| 41 | 41 |