On Mon, Jul 8, 2013 at 6:45 PM, Lyndsey <[email protected]> wrote:
> Thank you Ben.  I assume you mean something like what's being done here?  I
> think the problem is that I'm not using node, and that would be needed to do
> the following, correct?
>
> point->Wrap(args.This());  //Where Wrap is available because the C++ Point
> class extends ObjectWrap (from node.h)
>
> I would like to do this in "pure V8" without using node.  Is that possible?
> Am I making things too difficult?

Not at all.  In the snippet you posted, replace the call to
WrapPoint() with `args.This()->SetInternalField(0,
External::New(point));` and you should be good.

You may want to add args.IsConstructCall() and
constructor->HasInstance() checks to ensure that your constructor is
being invoked the way you expect it to.

In node.js we sidestep that issue by never exposing native code
directly to the user, there is always a JS shim in between.  That may
or may not work for you, YMMV.  Node.js has the luxury of being
allowed to assume that the executed JS code isn't hostile, unlike e.g.
a browser.

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to