Yes, that works.  But every time the callback function is called, This() 
object is the same one.

On Tuesday, October 14, 2014 6:03:30 AM UTC-7, Ben Noordhuis wrote:
>
> On Tue, Oct 14, 2014 at 7:20 AM, Jane Chen <[email protected] 
> <javascript:>> wrote: 
> > If I don't set return value, and only operate on This, how do I 
> associate a 
> > different C++ object to the newly constructed JS object? 
>
> You store the pointer to the C++ object in an InternalField slot on 
> the .This() object. 
>
> Make sure to reserve a slot with 
> function_template->InstanceTemplate()->SetInternalFieldCount(1), where 
> function_template is the FunctionTemplate of your constructor 
> function. 
>

-- 
-- 
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/d/optout.

Reply via email to