How to assign a function object to property of the napi object? #1173
-
A javascript object can be assigned with a function object as its property like: let extendableObj = { name: "example", extendsPlugin: (p) => { p.use(somePlugin) } } How to do when it comes to napi object? Try: #[napi(object)]
pub struct ExtendableObj {
pub name: &'static str,
pub extends_plugin: Box<dyn Fn()>,
} Not work as |
Beta Was this translation helpful? Give feedback.
Answered by
Brooooooklyn
May 9, 2022
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
yuchanns
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Box<dyn Fn>
is not supported to create from JavaScript function, useJsFunction
instead