Skip to content

Instantly share code, notes, and snippets.

@phsantiago
Last active February 27, 2019 09:28
Show Gist options
  • Save phsantiago/aa33c8a98e40dc79220245e6ac157bb7 to your computer and use it in GitHub Desktop.
Save phsantiago/aa33c8a98e40dc79220245e6ac157bb7 to your computer and use it in GitHub Desktop.
class Metronomo extends React.Component {
componentDidMount() {
this.primeiroContador = setInterval(
() => this.contagem(),
1000
);
this.segundoContador = setInterval(
() => this.contagem(),
500
);
this.terceiroContador = setInterval(
() => this.contagem(),
150
);
}
componentWillUnmount() {
clearInterval(this.primeiroContador);
clearInterval(this.segundoContador);
clearInterval(this.terceiroContador);
}
contagem() {
/* ... */
}
render() {
/* ... */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment