Commit 580a4bb4c73b953555b4de35b3cd0c49d1432033

Authored by Marcelo Puebla
1 parent 455398b6ee
Exists in master

Timer de tiempo de pantalla en reposo, para inicio y busqueda productos.

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 4 <div class="col-10 p-0 vh-100">
3 5  
4 6 <!-- TOP HEADER -->
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 4 @Component({
4 5 selector: 'app-master',
5 6 templateUrl: './master.component.html',
6 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 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 }