Skip to content

Commit

Permalink
Merge pull request #587 from timrach/patch-1
Browse files Browse the repository at this point in the history
Fix example code in doc/class_property_descriptor
  • Loading branch information
NickNaso authored Nov 13, 2019
2 parents df75e08 + b3609d3 commit aa79e37
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions doc/class_property_descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Example : public Napi::ObjectWrap<Example> {
static Napi::FunctionReference constructor;
double _value;
Napi::Value GetValue(const Napi::CallbackInfo &info);
Napi::Value SetValue(const Napi::CallbackInfo &info);
void SetValue(const Napi::CallbackInfo &info, const Napi::Value &value);
};

Napi::Object Example::Init(Napi::Env env, Napi::Object exports) {
Expand Down Expand Up @@ -52,12 +52,11 @@ Napi::Value Example::GetValue(const Napi::CallbackInfo &info) {
return Napi::Number::New(env, this->_value);
}

Napi::Value Example::SetValue(const Napi::CallbackInfo &info, const Napi::Value &value) {
void Example::SetValue(const Napi::CallbackInfo &info, const Napi::Value &value) {
Napi::Env env = info.Env();
// ...
Napi::Number arg = value.As<Napi::Number>();
this->_value = arg.DoubleValue();
return this->GetValue(info);
}

// Initialize native add-on
Expand Down

0 comments on commit aa79e37

Please sign in to comment.