mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-10-26 11:08:40 +03:00
support sync conditions
This commit is contained in:
parent
79446ad2ef
commit
12ddf94d25
@ -7,7 +7,12 @@ async function conditionPromise(
|
||||
while (true) {
|
||||
await timeoutPromise(100);
|
||||
|
||||
if (await condition()) {
|
||||
// if condition is sync
|
||||
if (condition.constructor.name !== 'AsyncFunction' && condition()) {
|
||||
return;
|
||||
}
|
||||
// if condition is async
|
||||
else if (await condition()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user