Hello. I'm trying to create new template that should match required behaviour but now i'm stuck with NamedPropertyHandler. What I need to achieve: 1. All property access calls should be processed by unified handlers (getter/setter for indexed access and getter/setter for named access). (This part is working). 2. Template also should have a set of predefined functions with different handlers for each. (This part is not working).
What I am doing. Assume that we have code like following: void NamedGetter(Local<Name> name, const PropertyCallbackInfo<Value> &info) { ... } void NamedSetter(Local<Name> name, Local<Value> value, const PropertyCallbackInfo<Value> &info) { ... } void IndexedGetter(uint32_t index, const PropertyCallbackInfo<Value> &info) { ... } void IndexedSetter(uint32_t index, Local<Value> value, const PropertyCallbackInfo<Value> &info) { ... } void FunctionAHandler(const FunctionCallbackInfo<Value> &info) { ... } //Lets skip initialization code... Local<String> funcName = String::NewFromUtf8(isolate, "FunctionA", v8:: NewStringType::kNormal).ToLocalChecked(); Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(funcName, FunctionTemplate::New(isolate, FunctionAHandler, funcName)); templ->SetHandler(NamedPropertyHandlerConfiguration(NamedGetter, NamedSetter )); templ->SetHandler(IndexedPropertyHandlerConfiguration(IndexedGetter, IndexedSetter)); //Creating instance of template in current context with name my_instance... Then, when i'm executing JS like "my_instance.FunctionA();" this is proccessed by V8 like i'm accessing property with name "FunctionA". I mean it's starting to execute NamedGetter function. And after that it fails with error: <unknown>:10: Uncaught TypeError: my_instance.FunctionA is not a function If I'm not adding NamedPropertyHandler to template - FunctionAHandler is invoked like expected. So my question is - how to avoid executing NamedGetter when function with such name is defined on template? Or maybe i't possible to proccess function calls inside NamedGetter and avoid creating handlers for each function I need in template? I would appreciate any help with this. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.