I am wrapping a C++ object with node::ObjectWrap
and I have some methods defined like:
auto tpl = NanNew<v8::FunctionTemplate>(New);
tpl->SetClassName(NanNew("className"));
tpl->InstanceTemplate()->SetInternalFieldCount(4);
NanSetPrototypeTemplate(tpl, NanNew("method1") , NanNew<v8::FunctionTemplate>(Method1) , v8::ReadOnly);
NanSetPrototypeTemplate(tpl, NanNew("method2") , NanNew<v8::FunctionTemplate>(Method2), v8::ReadOnly);
NanSetPrototypeTemplate(tpl, NanNew("method3") , NanNew<v8::FunctionTemplate>(Method3) , v8::ReadOnly);
NanSetPrototypeTemplate(tpl, NanNew("method4") , NanNew<v8::FunctionTemplate>(Method4), v8::ReadOnly);
Everything works just as expected and I can make an instance of the object in JS by:
var classInstance = new className();
All methods work just fine but when I try to log the function:
console.log(classInstance);
I am expecting to see something like:
{
method1 : [Native Function],
method2 : [Native Function],
method3 : [Native Function],
method4 : [Native Function]
}
But what I get is:
{}
Any thoughts on how to make these visible (aka enumerable)?