diff --git a/doc/api/addons.md b/doc/api/addons.md index 6c448d690be686..757f24c5194271 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -1081,6 +1081,7 @@ that can take two `MyObject` objects as input arguments: namespace demo { +using v8::Context; using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; @@ -1095,11 +1096,12 @@ void CreateObject(const FunctionCallbackInfo& args) { void Add(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); MyObject* obj1 = node::ObjectWrap::Unwrap( - args[0]->ToObject(isolate)); + args[0]->ToObject(context).ToLocalChecked()); MyObject* obj2 = node::ObjectWrap::Unwrap( - args[1]->ToObject(isolate)); + args[1]->ToObject(context).ToLocalChecked()); double sum = obj1->value() + obj2->value(); args.GetReturnValue().Set(Number::New(isolate, sum));