mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 20:31:27 +00:00
node: less unwraps (#6388)
* Update api/node/rust/interpreter/value.rs Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> --------- Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
This commit is contained in:
parent
68a4e15cff
commit
4b880a7b49
5 changed files with 171 additions and 17 deletions
|
|
@ -54,7 +54,10 @@ pub fn invoke_from_event_loop(env: Env, callback: JsFunction) -> napi::Result<na
|
|||
let function_ref = send_wrapper::SendWrapper::new(function_ref);
|
||||
i_slint_core::api::invoke_from_event_loop(move || {
|
||||
let function_ref = function_ref.take();
|
||||
let callback: JsFunction = function_ref.get().unwrap();
|
||||
let Ok(callback) = function_ref.get::<JsFunction>() else {
|
||||
eprintln!("Node.js: JavaScript invoke_from_event_loop throws an exception");
|
||||
return;
|
||||
};
|
||||
callback.call_without_args(None).ok();
|
||||
})
|
||||
.map_err(|e| napi::Error::from_reason(e.to_string()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue