Guest User

Untitled

a guest
May 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. newTimer() {
  2. this.countDown = this.timerProvider.newTimer(this.endTimer); //pass function below
  3. }
  4.  
  5. endTimer() {
  6.  
  7. const indexModal = this.viewCtrl.index;
  8. // then we remove it from the navigation stack
  9. //this.navCtrl.remove(2);
  10. if(this.answerModal) {
  11. this.answerModal.dismiss();
  12. }
  13. if(this.hintModal) {
  14. this.hintModal.dismiss();
  15. }
  16. this.navCtrl.push(WinnersPage, {
  17. gameId: this.gameId
  18. }).then(() => {
  19.  
  20. });
  21.  
  22. this.storage.set('firstAnswerCreated', '');
  23. this.playaudio.pause();
  24.  
  25. console.log('timer ENDED');
  26. }
  27.  
  28. countDown: any;
  29. counter = 1*100;
  30. tick = 1000;
  31.  
  32. constructor(public http: HttpClient) {
  33. //console.log('Hello TimerProvider Provider');
  34. }
  35.  
  36. newTimer(endTimer) {
  37. return Observable.timer(0, this.tick).take(this.counter).map(() => --this.counter).finally(() => endTimer());
  38. }
Add Comment
Please, Sign In to add comment