Commit 580a4bb4c73b953555b4de35b3cd0c49d1432033
1 parent
455398b6ee
Exists in
master
and in
1 other branch
Timer de tiempo de pantalla en reposo, para inicio y busqueda productos.
Showing
2 changed files
with
31 additions
and
4 deletions
Show diff stats
src/app/components/master/master.component.html
1 | <div class="row m-0 fade-in"> | 1 | <div |
2 | class="row m-0 fade-in" | ||
3 | (click)="reiniciarTimer"> | ||
2 | <div class="col-10 p-0 vh-100"> | 4 | <div class="col-10 p-0 vh-100"> |
3 | 5 | ||
4 | <!-- TOP HEADER --> | 6 | <!-- TOP HEADER --> |
5 | <app-header></app-header> | 7 | <app-header></app-header> |
6 | 8 | ||
7 | <router-outlet></router-outlet> | 9 | <router-outlet></router-outlet> |
8 | 10 | ||
9 | </div> | 11 | </div> |
10 | 12 | ||
11 | <!-- SIDEBAR --> | 13 | <!-- SIDEBAR --> |
12 | <app-sidebar class="sidebar position-fixed float-right col-2 col-md-2 vh-100 bg-primary-gradient p-2"> | 14 | <app-sidebar class="sidebar position-fixed float-right col-2 col-md-2 vh-100 bg-primary-gradient p-2"> |
13 | </app-sidebar> | 15 | </app-sidebar> |
14 | 16 | ||
15 | </div> | 17 | </div> |
16 | 18 |
src/app/components/master/master.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; |
2 | import { Router } from '@angular/router'; | ||
2 | 3 | ||
3 | @Component({ | 4 | @Component({ |
4 | selector: 'app-master', | 5 | selector: 'app-master', |
5 | templateUrl: './master.component.html', | 6 | templateUrl: './master.component.html', |
6 | styleUrls: ['./master.component.scss'] | 7 | styleUrls: ['./master.component.scss'] |
7 | }) | 8 | }) |
8 | export class MasterComponent implements OnInit { | 9 | export class MasterComponent implements OnInit, OnDestroy { |
9 | 10 | ||
10 | constructor() { } | 11 | private timerReposo: any |
12 | |||
13 | constructor( | ||
14 | private router: Router | ||
15 | ) { } | ||
11 | 16 | ||
12 | ngOnInit() { | 17 | ngOnInit() { |
18 | |||
19 | this.timerReposo = setTimeout(() => { | ||
20 | |||
21 | this.router.navigate(['cancelar-compra']); | ||
22 | }, 90000) | ||
23 | } | ||
24 | |||
25 | ngOnDestroy() { | ||
26 | |||
27 | clearTimeout(this.timerReposo); | ||
28 | } | ||
29 | |||
30 | reiniciarTimer() { | ||
31 | |||
32 | clearTimeout(this.timerReposo); | ||
33 | this.timerReposo = setTimeout(() => { | ||
34 | |||
35 | this.router.navigate(['cancelar-compra']); | ||
36 | }, 90000) | ||
37 | |||
13 | } | 38 | } |
14 | 39 | ||
15 | } | 40 | } |
16 | 41 |