ObjectTemplates are methods of creating objects and configuring objects
created with a specific function - its Function Template. Any object
created from an object template will have all of the properties that were
added to the object template. Theres no strict analog to the Javascript
language, (except by saying it might be a "Constructor function" - but its
not really) rather its more of an underlying implementation detail that v8
provides to you that allows you to powerfully leverage its internals.

There are some subtle differences between ObjectTemplates,
PrototypeTemplates, and InstanceTemplates, but for the most part they seem
fairly interchangeable for most purposes. I've been curious about this for
some time, and if someone would like to elucidate the difference(s) that
would be great.

If you want to add methods to an object in the method that you are
accustomed to with Javascript, I recommend using the PrototypeTemplate. It
behaves like you think it will, in that it completely preserves the
Prototype chain.

On Wed, Jun 6, 2012 at 3:43 PM, MikeM <[email protected]> wrote:

> I don't really understand the ObjectTemplate stuff yet, or how it
> helps me here.
> Examples are few and far between.
> Is the ObjectTemplate just a faster way to setup a global?
>
> > You can't really have objects make changes to other objects and have that
> > persist across contexts,
>
> I think I might be able to. The Context has two methods I think I can
> use to help me out.
> DetachGlobal()
> ReattachGlobal()
> These look like the ticket to reusing a global between several
> Contexts.
>
> But I'm not sure how to go about setting up the two globals the 1st
> time.
> How do I create the request global and NOT initialize any standard
> build in class prototypes?
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to