From 99c79f8d41c706ddcffed7137f971a6cb62e2230 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 11 Mar 2015 14:19:21 +0100 Subject: [PATCH] doc: call js function in null context It's good practice now to call JS functions that don't execute in a specific scope with v8::Null() as the receiver. Update the addons documentation. PR-URL: https://github.com/iojs/io.js/pull/1125 Reviewed-By: Rod Vagg Reviewed-By: Trevor Norris --- doc/api/addons.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/addons.markdown b/doc/api/addons.markdown index 8a008c2977dc39..1f0562ede2c938 100644 --- a/doc/api/addons.markdown +++ b/doc/api/addons.markdown @@ -215,6 +215,7 @@ there. Here's `addon.cc`: using v8::HandleScope; using v8::Isolate; using v8::Local; + using v8::Null; using v8::Object; using v8::String; using v8::Value; @@ -224,7 +225,7 @@ there. Here's `addon.cc`: Local cb = Local::Cast(args[0]); const unsigned argc = 1; Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; - cb->Call(isolate->GetCurrentContext()->Global(), argc, argv); + cb->Call(Null(isolate), argc, argv); } void Init(Local exports, Local module) {