Created
January 22, 2020 18:24
-
-
Save ctjlewis/931f7c04a359c172afc70df640985c3a to your computer and use it in GitHub Desktop.
Javascript function that waits until a given condition is true. await waitUntil(() => conditionIsTrue(data))
This file contains hidden or 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
window.waitUntil=function(c){function a(b){c()?b():window.requestAnimationFrame(function(){return a(b)})}return new Promise(a)}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Un-compiled: