Skip to content

Commit

Permalink
run async tasks as part of the event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Dec 28, 2024
1 parent 5e1e6cc commit b8e5744
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/dash_rt/src/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ fn inspect_array_into(
Ok(())
}

fn inspect_arraybuffer_into(arraybuffer: &ArrayBuffer, constructor: Symbol, out: &mut String) {
write!(out, "{constructor}({}) {{ ", arraybuffer.len()).unwrap();
fn inspect_arraybuffer_into(sc: &LocalScope<'_>, arraybuffer: &ArrayBuffer, constructor: Symbol, out: &mut String) {
write!(out, "{}({}) {{ ", sc.interner.resolve(constructor), arraybuffer.len()).unwrap();
for (i, byte) in arraybuffer.storage().iter().enumerate().take(32) {
if i > 0 {
*out += " ";
Expand Down Expand Up @@ -158,7 +158,7 @@ fn inspect_inner_into(
.extract::<ArrayBuffer>(scope)
.or_else(|| object.extract::<TypedArray>(scope).map(|t| t.arraybuffer(scope)))
{
inspect_arraybuffer_into(arraybuffer, constructor_name, out);
inspect_arraybuffer_into(scope, arraybuffer, constructor_name, out);
return Ok(());
}

Expand Down
3 changes: 3 additions & 0 deletions crates/dash_rt/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ impl Runtime {
}

pub async fn run_event_loop(mut self) {
self.vm.process_async_tasks();

if !self.state().needs_event_loop() {
return;
}
Expand All @@ -118,6 +120,7 @@ impl Runtime {
}
}

self.vm.process_async_tasks();
if !self.state().needs_event_loop() {
return;
}
Expand Down

0 comments on commit b8e5744

Please sign in to comment.