Skip to content

Instantly share code, notes, and snippets.

@Olegas
Last active November 28, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Olegas/7228b7254d04dd23ce99f191a18c9e3c to your computer and use it in GitHub Desktop.
Save Olegas/7228b7254d04dd23ce99f191a18c9e3c to your computer and use it in GitHub Desktop.
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