Created
November 3, 2019 09:32
-
-
Save agusputra/6da91ffec46e457e05d06e064a54cbe8 to your computer and use it in GitHub Desktop.
do-if.js
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
| function doIf(predicate, callback, timeOut) { | |
| setTimeout(() => { | |
| if (predicate()) { | |
| callback() | |
| } | |
| else { | |
| doIf(predicate, callback); | |
| } | |
| }, timeOut) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment