summaryrefslogtreecommitdiff
path: root/source/helpers/wait-for.ts
diff options
context:
space:
mode:
authorGravatar Federico Brigante <me@fregante.com> 2021-05-30 19:09:51 +0700
committerGravatar GitHub <noreply@github.com> 2021-05-30 19:09:51 +0700
commit9f9fe46e2d07377ca2194c3ef9ed3a7f0c374e2d (patch)
treeb972bcf19bec88ab2db09d818b751c8b1e59ce43 /source/helpers/wait-for.ts
parent13bbf07553ae88dd16646e9a02c0718250298ea1 (diff)
downloadrefined-github-9f9fe46e2d07377ca2194c3ef9ed3a7f0c374e2d.tar.gz
refined-github-9f9fe46e2d07377ca2194c3ef9ed3a7f0c374e2d.tar.zst
refined-github-9f9fe46e2d07377ca2194c3ef9ed3a7f0c374e2d.zip
Fix: Extension may fail to load if custom CSS is specified (#4431)
Diffstat (limited to 'source/helpers/wait-for.ts')
-rw-r--r--source/helpers/wait-for.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/helpers/wait-for.ts b/source/helpers/wait-for.ts
new file mode 100644
index 00000000..16498847
--- /dev/null
+++ b/source/helpers/wait-for.ts
@@ -0,0 +1,8 @@
+import delay from 'delay';
+
+export default async function waitFor(condition: () => any): Promise<void> {
+ while (!condition()) {
+ // eslint-disable-next-line no-await-in-loop
+ await delay(10);
+ }
+}