NAN 1.7.0 introduced an optional target
parameter for NanCallbackCall
. This parameter allows you to set the context for the callback i.e. this
.
However not matter what I do the this
value in my JavaScript callback is always the default Global
context. I would expect the following to make foo
available on this
in my JavaScript callback.
Local<Object> context = NanNew<Object>();
context->Set(NanNew<String>("foo"), NanNew<String>("bar"));
myNanCallback->Call(context, argv_v8.size(), &argv_v8[0]);