Is there a way to create a Proxy object? #1585
Answered
by
Brooooooklyn
vincent-herlemont
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I have tried this: #[napi]
pub fn create_proxy(&self, env: Env) -> napi::Result<JsObject> {
let target = env.create_object()?;
let handler = env.create_object()?;
// /!\ create_proxy is unknown and we need to find a way
// to make it.
let proxy_constructor = env
.get_global()?
.get_named_property_unchecked::<JsFunction>("Proxy")?;
let js_unknown = proxy_constructor.call(None, &[target, handler])?;
let proxy = js_unknown.coerce_to_object()?;
Ok(proxy)
} But the following issue happens: const result = db.createProxy()
TypeError {
message: 'Constructor Proxy requires \'new\'',
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to create a Proxy object?
basically, what i'm going to do:
Beta Was this translation helpful? Give feedback.
All reactions