Questions tagged [cleartimeout]

186 questions
12
votes
3 answers

How to clear a settimeout in react

On each question component, I am trying to clear the time out. So on componentWillMount() I will start the timer and then on componentDidUpdate() I will clear the timeout. The timer does not seem to be working.After the timer expires I will push the…
jdip88
  • 427
  • 2
  • 9
  • 23
10
votes
3 answers

Why is clearTimeout not clearing the timeout in this react component?

I am attempting to clear a former timeout before initiating a new timeout, because I want messages to display for 4 seconds and disappear UNLESS a new message pops up before the 4 seconds is up. The Problem: Old timeouts are clearing the current…
Gabriel Kunkel
  • 2,643
  • 5
  • 25
  • 47
8
votes
2 answers

how to clear all javascript Timeouts?

i have a loop function that in first 5 seconds it runs social1() and in second 5 seconds it runs social2() then loop ... i have 2 hover functions too i need clear all active timeouts because when i hover on images (.social1 & .social2), i can see…
Mohammad Masoudian
  • 3,483
  • 7
  • 27
  • 45
6
votes
2 answers

How to clearTimeout an async function when componentWillUnmount in a Reactjs component?

Here is the component: class ChartComp extends Component{ constructor(props){ super(props); this.timer = null; this.loadData = this.loadData.bind(this); } componentWillMount(){ this.loadData(); } …
Cinque
  • 115
  • 1
  • 1
  • 4
5
votes
1 answer

clearTimeout() for setTimeout() in for loop

clearTimeout() inside for loop doesn't work for(i=0;i<10;i++){ myVar = setTimeout(function(){ alert("Hello") }, 3000); } Fiddle : not working Fiddle : working Please help me to stop setTimeout() in first Fiddle.
user3941922
4
votes
2 answers

setTimeout and clearTimeout in React

I'm struggling with creating a logout feature when users don't make any click event for 30 seconds on the page using setTimeout and clearTimeout. But every time the users click anything on the page, the remaining time must be reset to 30 seconds…
4
votes
2 answers

JS clear timer of previous function call before new function call

My React app uses a slider component from Material UI. Its onChange event calls a function to update the state. I realized that my component rerenders for every slider step which is why I want to delay the updating of the state for like 300ms after…
Rtholl
  • 75
  • 4
4
votes
2 answers

How to implement Idle time in angular using native JS code?

I have to detect user's idle time out in my application. My application is using both native javascript and angular. in my HTML + JavaScript page i implemented below: