Hello,
I'm trying to create a global object which inherits an EventTarget object. The EventTarget uses an InternalField with an external pointing to an instance of a class designed to handle events. When instantiating the EventTarget by itself in JS/C++, it works as expected, the constructor of EventTarget is called. When trying to use globalThis inherited properties (addEventListener for instance), the InternalField is not filled. I've pinpointed the cause of this issue to the constructor of the Global object (and by extension, the inherited EventTarget) not being called. Simplified code: ``` // isolate is in scope. Single thread, not used anywhere else Local<FunctionTemplate> Window = FunctionTemplate::New( isolate ); // eventTargetCtor is a very simple Local<FunctionTemplate> EventTarget = FunctionTemplate::New( isolate, eventTargetCtor ); EventTarget->PrototypeTemplate()->SetInternalFieldCount(1); // Event Target adddEventListener/dispatchEvent/removeEventListener are set using EventTarget->PrototypeTemplate()->Set (ignored for simplicity) Local<FunctionTemplate> global = Window; auto globalProto = Window->PrototypeTemplate(); Window->Inherit(EventTarget); globalProto->Set(isolate, "EventTarget", EventTarget); Local<Context> context = Context::New(isolate, nullptr, globalProto); ``` Is there a way to get the constructor to be called, or do I have to change my layout ? -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/6524684f-bef1-4c07-b5f8-ed8bce758ef1n%40googlegroups.com.