reactjs / react-timer-mixin

TimerMixin provides timer functions for executing code in the future that are safely cleaned up when the component unmounts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to done pause and reset using react-timer-mixin

shaikhussian opened this issue · comments

hai i am using this module for pause and reset time but i am struggling that how to pause the timer,stop the timer,reset the timer, here i am attaching the image of the view

demo-timer

plaese help me how to done i used

TimerMixin.setTimeout(
      () => { console.log('I do not leak!'); },
      5000
    );

but timer not stop,help me that how to pause the timer

Please respond for it

@shaikhussian react-timer-mixin isn't actually meant to provide an actual timer interface. It's just a tool to help manage setTimeout / setInterval / setImmediate calls in a React component.

If you wanted to implement a pausable timer you'd have to do that yourself. You could track the current time in this.state.time and have a like pauseTimer and resumeTimer that cleared and set the setInterval call, respectively.