Last active
November 28, 2019 18:09
-
-
Save Olegas/7228b7254d04dd23ce99f191a18c9e3c 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
class DoStuff { | |
runAnimation() { | |
return new Promise((resolve, reject) => { | |
const run = true; | |
const step = () => { | |
if (run) { | |
run = this._doSomething(); | |
requestAnimationFrame(step); | |
} else { | |
resolve(); | |
} | |
} | |
step(); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment