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

Is this project still useful ?

LouisJS opened this issue · comments

Is this project still useful.
it hasn't be updated in the last two year.

And doesn't seem to work in ES6

commented

What are react native timer alternatives?

I am still using this in react-native to force GPS geolocation updates.

  componentDidMount() {
    try {
      // Use timer to force GPS update
      // watchPosition updates too slowly, maybe every 10 seconds
      this.setInterval(() => {
        try {
          if (this.state.killTimerMixin) { return; }
          this.geoWatchStop();
          this.geoWatchStart();
        } catch (error) {
          // Exception is thrown when  database item this view was displaying is deleted in another view.
          // ToDo: How to stop and shut down the TimerMixin ?
          this.clearTimeout();  // < clearTimeout does NOT stop it
        }
      }, 3000);