ark::js::detail::JSValueWrapper

Defined in header “ark/js/detail/jsvalue_wrapper.hh”.


Wraps JSValue from QuickJS. Since we don’t/can’t know what the JSValue type is, as it changes based on architecture, we need to wrap it and include quickjs in this private header.

Methods

  • JSValueWrapper(JSContext * context, std::optional< JSValue > this_object, JSValue value, std::string name, JSValueWrapperOwnership ownership)
    Initializes the wrapper against this value. The wrapper now owns the value, and the value will be destroyed when it goes out of scope.

    This value wrapper does not own the ’this_object’, which is the parent object or scope of the value.

  • ~JSValueWrapper()
    Destroys the underlying value.

  • JSContext * context()
    Returns the context that owns this value.

  • std::optional< JSValue > this_object()
    Returns the namespace/object that owns this value (such as the global namespace, or some scope/class).

  • JSValue value()
    Returns the underlying value.

  • void set_value(JSValue value)
    Changes the underlying value. The existing value will be released.

  • const std::string & name()
    Returns the name of this property.,.