The Napi::Object::PropertyLValue class is a helper class provided by
Napi::Object to allow more intuitive assignment of properties.
#include <napi.h>
using namespace Napi;
Void Init(Env env) {
// Create a new instance
Object obj = Object::New(env);
// Assign a value to a property.
obj["hello"] = "world";
}In the above example, obj["hello"] returns a Napi::Object::PropertyLValue
whose operator=() method accepts a string which will become the value of the
"hello" property of the newly created object.
In general, obj[key] = value is the equivalent of obj.Set(key, value), where
the types of key and value are all those supported by
Napi::Object::Set().
operator Value() const;Implicitly casts this Napi::Object::PropertyLValue to a Napi::Value.
template <typename ValueType>
PropertyLValue& operator =(ValueType value);[in] valuea value to assign to the property referred to by theNapi::Object::PropertyLValue. The type of the value is one of the types supported by the second parameter ofNapi::Object::Set().
Returns a self-reference.