From 580a4bb4c73b953555b4de35b3cd0c49d1432033 Mon Sep 17 00:00:00 2001 From: mpuebla Date: Thu, 22 Aug 2019 15:57:05 -0300 Subject: [PATCH] Timer de tiempo de pantalla en reposo, para inicio y busqueda productos. --- src/app/components/master/master.component.html | 4 +++- src/app/components/master/master.component.ts | 31 ++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/app/components/master/master.component.html b/src/app/components/master/master.component.html index a6c09d6..c4e74a3 100644 --- a/src/app/components/master/master.component.html +++ b/src/app/components/master/master.component.html @@ -1,4 +1,6 @@ -
+
diff --git a/src/app/components/master/master.component.ts b/src/app/components/master/master.component.ts index 0fbe076..726d088 100644 --- a/src/app/components/master/master.component.ts +++ b/src/app/components/master/master.component.ts @@ -1,15 +1,40 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Router } from '@angular/router'; @Component({ selector: 'app-master', templateUrl: './master.component.html', styleUrls: ['./master.component.scss'] }) -export class MasterComponent implements OnInit { +export class MasterComponent implements OnInit, OnDestroy { - constructor() { } + private timerReposo: any + + constructor( + private router: Router + ) { } ngOnInit() { + + this.timerReposo = setTimeout(() => { + + this.router.navigate(['cancelar-compra']); + }, 90000) + } + + ngOnDestroy() { + + clearTimeout(this.timerReposo); + } + + reiniciarTimer() { + + clearTimeout(this.timerReposo); + this.timerReposo = setTimeout(() => { + + this.router.navigate(['cancelar-compra']); + }, 90000) + } } -- 1.9.1