5#ifndef MOLYBDEN_JS_OBJECT_HPP
6#define MOLYBDEN_JS_OBJECT_HPP
10#include "molybden/js/js_return_value.hpp"
26class JsObject :
public std::enable_shared_from_this<JsObject> {
28 using Private = JsObjectImpl;
30 explicit JsObject(std::unique_ptr<Private> impl);
36 std::shared_ptr<molybden::Frame>
frame();
45 std::shared_ptr<T>
as();
110 bool putProperty(
const std::string& name, T&& value);
150 std::unique_ptr<Private> impl_;
153 bool putPropertyValue(
const std::string& name,
const JsValue& value);
155 const std::vector<JsValue>& args);
A JavaScript object.
Definition js_object.hpp:26
std::vector< std::string > propertyNames()
Returns an immutable list of the names of the properties of this JavaScript object,...
JsValue getProperty(const std::string &name)
Returns the value of the JavaScript object's property with the given name.
bool hasProperty(const std::string &name)
Checks whether the JavaScript object has a property or function with the given name.
JsReturnValue call(const std::string &method_name, T &&... args)
Executes the method with the given method_name and the args in the JavaScript object.
Definition js_object_detail.hpp:23
std::shared_ptr< T > as()
Returns the shared pointer of type T to this object if it represents one, or nullptr otherwise.
Definition js_object_detail.hpp:13
bool putProperty(const std::string &name, T &&value)
Creates a new property with the given name or updates the existing one in the current JavaScript obje...
Definition js_object_detail.hpp:28
std::shared_ptr< molybden::Frame > frame()
Returns the shared pointer to the Frame instance of this JavaScript object.
bool removeProperty(const std::string &name)
Removes a property with the given name in the JavaScript object and returns true if the property was ...
std::vector< std::string > ownPropertyNames()
Returns an immutable list of the names of the properties of this JavaScript object,...
Represents the JS function return value.
Definition js_return_value.hpp:35
A JavaScript value.
Definition js_value.hpp:44