diff options
| author | Adam Soltys <[email protected]> | 2022-12-28 15:05:00 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-12-28 15:05:00 -0800 |
| commit | 065721964152f1022e755c33d24353beaa07abd1 (patch) | |
| tree | 8abece462a0f4c8269f343ea1f4679a9d4e36a29 /src/lib/utils.js | |
| parent | 671ec0529f466c3fc9218e928486f0277bd4c990 (diff) | |
| download | coinos-ui-065721964152f1022e755c33d24353beaa07abd1.tar.gz coinos-ui-065721964152f1022e755c33d24353beaa07abd1.zip | |
get follows and followers working
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js index e1088cac..e5441575 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -172,9 +172,10 @@ export const sats = 100000000; export const back = () => browser && history.go(-1); export const focus = (el) => setTimeout(() => el.focus()); -export const wait = async (f, s = 300) => { +export const sleep = (n) => new Promise((r) => setTimeout(r, n)); +export const wait = async (f, n = 100, s = 300) => { let i = 0; - while (!(await f()) && i < s) (await sleep(1000)) && i++; + while (!(await f()) && i < s) (await sleep(n)) && i++; if (i >= s) throw new Error('timeout'); return f(); }; |
