Skip to content

Commit 5b61ed0

Browse files
committed
feat: add advance_event_loop_async
1 parent 58c198e commit 5b61ed0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/runtime.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl Runtime {
160160
}
161161

162162
/// Advance the JS event loop by a single tick
163-
/// See [`Runtime::await_event_loop`] for fully running the event loop
163+
/// See [`Runtime::block_on_event_loop`] for fully running the event loop
164164
///
165165
/// Returns true if the event loop has pending work, or false if it has completed
166166
///
@@ -173,6 +173,24 @@ impl Runtime {
173173
self.block_on(|runtime| async move { runtime.inner.advance_event_loop(options).await })
174174
}
175175

176+
/// Advance the JS event loop by a single tick
177+
/// See [`Runtime::await_event_loop`] for fully running the event loop
178+
///
179+
/// Returns a future that resolves true if the event loop has pending work, or false if it
180+
/// has completed
181+
///
182+
/// # Arguments
183+
/// * `options` - Options for the event loop polling, see [`deno_core::PollEventLoopOptions`]
184+
///
185+
/// # Errors
186+
/// Can fail if a runtime error occurs during the event loop's execution
187+
pub async fn advance_event_loop_async(
188+
&mut self,
189+
options: PollEventLoopOptions,
190+
) -> Result<bool, Error> {
191+
self.inner.advance_event_loop(options).await
192+
}
193+
176194
/// Run the JS event loop to completion, or until a timeout is reached
177195
/// Required when using the `_immediate` variants of functions
178196
///

0 commit comments

Comments
 (0)