Change Display with Timer


#1

how navigate in my app with a timer
i want change a display after 5 seconds


#2

Hi @erickfer17. Define a variable for timer and give it a value of 5. Then call the following function when you want to start the timer:

  //set the value to 5 and call the function to start the timer
  this.currentTime = 5;
  this.startTimer();

  startTimer()
  {
    setTimeout(x => 
    {
      if(this.currentTime <= 0) 
      {}
      this.currentTime--;

      if(this.currentTime > 0)
      {
        this.startTimer();
      }
      else
      {
        // navigate to where you want
      }
    }, 1000);
  }

I hope this will help you.
Cheers!!!


#3

thaks for help me! :slight_smile: