ark::js::JavaScriptValue
Defined in header “ark/js/js_value.hh”.
Represents a value, bound to some particular javascript runtime and context. These values must all be destroyed before the host runtime goes down.
Methods
-
~JavaScriptValue()
Destructor. Frees memory related to this value. -
bool defined()
Returns true if this value is defined or not. -
bool null()
Returns true if this value is null or not. -
Type get()
Retrieves the value as a C++ primitive. Supported types are int32_t, int64_t, double, bool, and std::string. -
void set(const Type & value)
Sets the given value as a C++ primitive. Supported types are int64_t, double, bool, and std::string. -
void set_to_new_object()
Sets the given value as if it was an empty object. -
JavaScriptValue get_value(const std::string & name)
Returns the JavaScript value that is a child of this value. -
JavaScriptValue duplicate()
Returns a copy of the current value. -
JavaScriptValue module_namespace()
Returns the module namespace.