From 05c881683e78202e0843ad477b6a39ebd7af18f4 Mon Sep 17 00:00:00 2001 From: jedel1043 Date: Mon, 6 Feb 2023 10:47:18 -0600 Subject: [PATCH] Fix example --- boa_examples/src/bin/futures.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/boa_examples/src/bin/futures.rs b/boa_examples/src/bin/futures.rs index 934ef99f484..1ab9565405b 100644 --- a/boa_examples/src/bin/futures.rs +++ b/boa_examples/src/bin/futures.rs @@ -5,11 +5,10 @@ use std::{ }; use boa_engine::{ - builtins::JsArgs, context::ContextBuilder, job::{FutureJob, JobQueue, NativeJob}, native_function::NativeFunction, - Context, JsResult, JsValue, + Context, JsArgs, JsResult, JsValue, Source, }; use futures_util::{stream::FuturesUnordered, Future}; use smol::{future, stream::StreamExt, LocalExecutor}; @@ -130,7 +129,7 @@ fn main() { // Initialize the required executors and the context let executor = LocalExecutor::new(); let queue = Queue::new(executor); - let context = &mut ContextBuilder::new().job_queue(&queue).build(); + let context = &mut ContextBuilder::new().job_queue(&queue).build().unwrap(); // Bind the defined async function to the ECMAScript function "delay". context.register_global_builtin_callable("delay", 1, NativeFunction::from_async_fn(delay)); @@ -148,7 +147,7 @@ fn main() { "#; let now = Instant::now(); - context.eval(script).unwrap(); + context.eval_script(Source::from_bytes(script)).unwrap(); // Important to run this after evaluating, since this is what triggers to run the enqueued jobs. context.run_jobs();