Last active
April 19, 2017 19:58
-
-
Save AlanBreck/eedf9bac93e5544b523462ad8a4baf8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateProgress = () => { | |
this.setState({ progress: 0 }); | |
const min = 1; | |
const max = 60; | |
const totalTime = Math.floor(Math.random() * (max - min + 1) + min); | |
let counter = 0; | |
var progInterval = setInterval(() => { | |
counter++; | |
this.setState({ | |
progress: counter / (totalTime * 60) * 100 | |
}); | |
if (counter >= totalTime * 60) { | |
clearInterval(progInterval); | |
counter = 0; | |
console.log("done"); | |
} | |
}, 16); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment