Hello everyone, I've read a lot of information about FunctionTemplate / Function / PrototypeTemplate / InstanceTemplate, but some details are still not clicking for me. I feel like maybe there is a gap in the documentation that I hope the answers to these questions can help fill:
(FWIW, I'm creating a two-way association between C++ and javascript objects) 1. The documentation for FunctionTemplate.PrototypeTemplate says it's the "template used to create the prototype object of the function created by this template". But what is the role of a "prototype object" for a function? I understand the concept of a "prototype" for an object, but not a function. From what I understand, the new object will already inherit all properties/methods defined on the Function and FunctionTemplate, so what's the prototype object needed for? And if there's only one prototype object, why do we need a template for it? 2. What is the difference between a prototype template and an instance template? 3. What is the difference if I put a property on the FunctionTemplate, the Function, the PrototypeTemplate or the InstanceTemplate? What should I be taking into account when deciding where to put the property? 4. Should I use the same logic for functions/methods as well? Or are there different considerations for functions? 5. If I have a constructor function that I want to run when the new objects of the class are created, where should that go? 6. Depending on the answers to the previous 3, this question may be moot, but: Is there any reason to have the same function or property on two or more of these "entities"? FunctionTemplate and Function? Or Function and PrototypeTemplate? etc. For example, I have some existing code that is first setting a property (via Set) on the PrototypeTemplate of the FunctionTemplate, then it also sets that same property (with same value) on the FunctionTemplate. What might be the intent here? 7. I've seen code that calls RemovePrototype on the FunctionTemplate (or maybe the Function....I'm not sure). For what reason would you do this? Thanks in advance for any help! :) . -- -- 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/f5f493a0-23e1-446b-9707-4aca7c44dd30o%40googlegroups.com.