I have next JS code:
my_cpp_object.my_function(); // Works fine
var func = my_cpp_object.my_function;
func(); // Error, callback have not pointer to C++ object
This code should work fine in theory. But not in case the my_cpp_object is object which I create by v8::ObjectTemplate and v8::Context::Set(), because objects that I add to context by this way stores pointers to C++ object instance.
And when I call my_cpp_object.my_function() it's call a callback function with const v8::FunctionCallbackInfo<v8::Value>& argument which have pointer to C++ object.
But when I call func() it's call a callback with const v8::FunctionCallbackInfo<v8::Value>& argument too, but there is no pointer to C++ object (args.Holder().As<v8::Object>()->InternalFieldCount() == 0)
Is it possible to resolve this problem?