Last active
November 1, 2020 12:45
-
-
Save chanonroy/f9c85273d31c949c661e6725aede6d68 to your computer and use it in GitHub Desktop.
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
| export const waitFor = async (cb: any) => { | |
| let c = 0 | |
| async function f() { | |
| try { | |
| await cb() | |
| } catch (error) { | |
| if (c < 9) { | |
| c += 1 | |
| setTimeout(f, 500) | |
| } | |
| } | |
| } | |
| await f() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment