diff --git a/lib/src/fnc/script/fetch_stub/mod.rs b/lib/src/fnc/script/fetch_stub/mod.rs index e497e09a..66570b11 100644 --- a/lib/src/fnc/script/fetch_stub/mod.rs +++ b/lib/src/fnc/script/fetch_stub/mod.rs @@ -1,6 +1,6 @@ //! stub implementations for the fetch API when `http` is not enabled. -use js::{class::Trace, Class, Ctx, Exception, Result}; +use js::{class::Trace, Class, Ctx, Exception, Function, Result}; #[cfg(test)] mod test; @@ -13,8 +13,7 @@ pub fn register(ctx: &Ctx<'_>) -> Result<()> { Class::::define(&globals)?; Class::::define(&globals)?; Class::::define(&globals)?; - globals.set("fetch", Function::new(ctx, js_fetch).with_name("fetch")); - Ok(()) + globals.set("fetch", Function::new(ctx.clone(), js_fetch)?.with_name("fetch")?) } #[js::function]