[quickjs-wasm-rs] Should the closure passed to wrap_callback
return JSValueRef
?
#608
Labels
enhancement
New feature or request
wrap_callback
return JSValueRef
?
#608
Currently, the closure passed to
wrap_callback
isimpl FnMut(&Self, JSValueRef<'_>, &[JSValueRef<'_>]) -> Result<JSValue> + 'static
.This has worked well so far, however, this makes it impossible to return an already existing value and maintain referential equality. For example:
As
JSValue
is a context-independent representation of a JS value, would it make sense for a callback to always return a context-specific value, which can be easily created from a givenJSValue
usingto_qjs_value()
?(Side-note: Would be great to also implement
PartialEq
forJSValueRef
.)The text was updated successfully, but these errors were encountered: