Hi, Alfred and Stephan,
So, Does that means that we can get multiple function instance from single template in a context? There seems has a contradiction with document from google, Please check the bold part of following text. Is the document from google wrong? >From http://code.google.com/apis/v8/embed.html Templates A template is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated by JavaScript scripts. For example, Google Chrome uses templates to wrap C++ DOM nodes as JavaScript objects and to install functions in the global namespace. You can create a set of templates and then use the same ones for every new context you make. You can have as many templates as you require. *However you can only have one instance of any template in any given context.* On Tue, Oct 27, 2009 at 11:07 AM, Stephan Beal <[email protected]>wrote: > On Tue, Oct 27, 2009 at 2:44 AM, Alfred Rossi <[email protected]> wrote: > >> It would seem that whenever you call GetFunction() you get a distinct >> function based on the current state of the template. That is, if you >> add something to the template and call it again you get a different >> function, distinct from the first, with additional members. I assume >> that this is the intended behavior. >> > > Aha. That sounds reasonable, i guess. That would explain the problem i was > chasing before i learned (through trial an error) not to call GetFunction() > on my ctor template "too early" in the class binding process. > > What's really important to my case, though: if i call it twice _without_ > modifying the template, will i get the same function object or not? > > Thanks :). > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > > > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
