Commit 2c2acf99d0c1521e7a4be38364a70317dc103188
1 parent
0e3940a251
Exists in
develop
quitar TimeOut en pantalla mensaje-final
Showing
1 changed file
with
12 additions
and
17 deletions
Show diff stats
src/app/modules/mensaje-final/mensaje-final.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from "@angular/core"; |
| 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from "src/app/services/articulo/articulo.service"; |
| 3 | import { Router } from '@angular/router'; | 3 | import { Router } from "@angular/router"; |
| 4 | 4 | ||
| 5 | @Component({ | 5 | @Component({ |
| 6 | selector: 'app-mensaje-final', | 6 | selector: "app-mensaje-final", |
| 7 | templateUrl: './mensaje-final.component.html', | 7 | templateUrl: "./mensaje-final.component.html", |
| 8 | styleUrls: ['./mensaje-final.component.scss'] | 8 | styleUrls: ["./mensaje-final.component.scss"] |
| 9 | }) | 9 | }) |
| 10 | export class MensajeFinalComponent implements OnInit { | 10 | export class MensajeFinalComponent implements OnInit { |
| 11 | timer: any; | 11 | timer: any; |
| 12 | 12 | ||
| 13 | constructor( | 13 | constructor( |
| 14 | public articuloService: ArticuloService, | 14 | public articuloService: ArticuloService, |
| 15 | private router: Router, | 15 | private router: Router |
| 16 | ) { } | 16 | ) {} |
| 17 | 17 | ||
| 18 | ngOnInit() { | 18 | ngOnInit() { |
| 19 | this.timer = setTimeout(() => { | ||
| 20 | this.goToSplash(); | ||
| 21 | }, 15000); | ||
| 22 | this.mediaPantalla(); | 19 | this.mediaPantalla(); |
| 23 | } | 20 | } |
| 24 | 21 | ||
| 25 | OnDestroy() { | 22 | OnDestroy() {} |
| 26 | clearTimeout(this.timer); | ||
| 27 | } | ||
| 28 | 23 | ||
| 29 | goToSplash() { | 24 | goToSplash() { |
| 30 | this.articuloService.cleanShoppingCar(); | 25 | this.articuloService.cleanShoppingCar(); |
| 31 | this.router.navigate(['']); | 26 | this.router.navigate([""]); |
| 32 | } | 27 | } |
| 33 | 28 | ||
| 34 | mediaPantalla() { | 29 | mediaPantalla() { |
| 35 | if ($('body').hasClass('media-pantalla')) { | 30 | if ($("body").hasClass("media-pantalla")) { |
| 36 | $('body').removeClass('media-pantalla'); | 31 | $("body").removeClass("media-pantalla"); |
| 37 | } | 32 | } |
| 38 | } | 33 | } |
| 39 | } | 34 | } |
| 40 | 35 |