diff options
Diffstat (limited to '')
-rw-r--r-- | src/bun.js/javascript.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index 713ab7264..9ba56fffa 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -571,6 +571,16 @@ pub const VirtualMachine = struct { this.eventLoop().tick(); } + pub fn waitFor(this: *VirtualMachine, cond: *bool) void { + while (!cond.*) { + this.eventLoop().tick(); + + if (!cond.*) { + this.eventLoop().autoTick(); + } + } + } + pub fn waitForPromise(this: *VirtualMachine, promise: JSC.AnyPromise) void { this.eventLoop().waitForPromise(promise); } |