depends on what you mean by wrapper. Typically, we'd call a JS object that
corresponds to an embedder object a "wrapper"

On Wed, Oct 12, 2016 at 12:28 AM Zac Hansen <xax...@gmail.com> wrote:

> why wouldn't you just use a v8::External?  Isn't that exactly what they're
> meant for?
>
>
> On Monday, October 10, 2016 at 5:08:54 AM UTC-7, Riccardo Corsi wrote:
>
> will do, thanks!
>
> On Fri, Oct 7, 2016 at 7:19 AM, Jochen Eisinger <joc...@chromium.org>
> wrote:
>
> If possible, reusing the object template will save space, and is preferable
>
> On Thu, Oct 6, 2016 at 8:18 PM Riccardo Corsi <riccard...@kairos3d.it>
> wrote:
>
> Hi all,
>
> I'm using ObjectTemplate to create JS empty objects that are simple
> wrappers of a c++ object
> (in the JS code they are just used as "handles" to pass the objects around
> in the script).
>
> I was just wondering if there is any issue or penalty to use a new
> ObjectTemplate every time (see code below)
> or if I should store the ObjectTemplate in a persistent handle and reuse
> it.
>
> Thank you,
> Ricky
>
> v8::Handle<v8::Object> WrapNativeElem(NativeElem* elem)
>    {
>       Isolate* isolate = Isolate::GetCurrent();
>       EscapableHandleScope handle_scope(isolate);
>
>       // create an empty object
>       v8::Handle<v8::ObjectTemplate> elem_templ = v8::ObjectTemplate::New
> ();
>       elem_templ->SetInternalFieldCount(1);
>       v8::Local<v8::Object> wrapper = elem_templ->NewInstance();
>
>       // set the game state as internal field and return the wrapper
>       wrapper->SetInternalField(0, External::New(Isolate::GetCurrent(),
> elem));
>       return handle_scope.Escape(wrapper);
>    }
>
>
> --
> --
> v8-users mailing list
>
> v8-u...@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+u...@googlegroups.com.
>
>
> For more options, visit https://groups.google.com/d/optout.
>
> --
> --
> v8-users mailing list
>
> v8-u...@googlegroups.com
>
>
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-users/GQmzqNKKDrQ/unsubscribe.
>
> To unsubscribe from this group and all its topics, send an email to
> v8-users+u...@googlegroups.com.
>
>
> For more options, visit https://groups.google.com/d/optout.
>
> --
> --
> 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.
>

-- 
-- 
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.

Reply via email to