Questions tagged [clearinterval]

The Javascript clearInterval() method clears a timer set with the setInterval() method.

The Javascript clearInterval() method clears a timer set with the setInterval() method.
The ID value returned by setInterval() is used as the parameter for the clearInterval() method.

660 questions
2
votes
1 answer

How to clearInterval if the setInterval was called via ref from a parent component in vue2?

I have a parent in which I call a function startTimer() with a ref and I want to stop this Timer directly within the child component but that doesn't work. I read somewhere that arrow functions in the setInterval can make problems but it did not…
2
votes
3 answers

Why is clearInterval not stopping my timer?

I am trying to build a timer with three buttons, a start, stop, where it stops on the current integer, and a reset. I have added my code below which results in the following issues. I thought my stop function would stop the timer from decrementing…
MouseWarrior
  • 391
  • 4
  • 19
2
votes
5 answers

clearInterval not working in React Application using functional component

I wanted to build a timer application in React using functional component and below are the requirements. The component will display a number initialized to 0 know as counter. The component will display a Start button below the counter number. On…
2
votes
2 answers

how to clearInterval if any previous setInterval is running in REACT?

I want to make a Reverse Countdown Timer in which that has an input field and when I type a number and press the "Enter" key, the countdown starts. but the problem is when I want to stop the previous interval and starts new interval with new number…
Anant Jain
  • 23
  • 5
2
votes
1 answer

React clearInterval not working in class Component

I am trying to make a timer that will start at the beginning of the sorting visualization and run until sorting is over. The timer starts accordingly but does not stop after sorting. this works absolutely fine in functional Component (with useEffect…
Saif789
  • 69
  • 3
2
votes
2 answers

Call function at predefined irregular intervals in JavaScript

I have to run some code after some predefined irregular intervals after users takes some action like a button click. The intervals could be [1, 1.2, 2.05, 2.8, ...., 10.56], [0.2, 1.5, 3.9, 4.67, 6.8, .., 12.0] or something else. So, the function…
Real Noob
  • 1,369
  • 2
  • 15
  • 29
2
votes
2 answers

can't use clearInterval

in trying to create a page that will show the current time which will refresh every x seconds - x is a user input i use setInterval and clearInterval but it looks like the clearInterval doesn't have any effect at all :( here's the code: