What exactly do you want to store; just one class instance - or do you have an 
existing C++ class that you are extending to be v8 compatible? There is a giant 
difference between these cases.

The first case is what I am doing for nodejs currently; I am taking an existing 
c++ class (Fl_Window) and writing  a wrapper AROUND it (nFl_Window). So in this 
case, I am just storing a void pointer to the c++ class in the internal field 
count. And at the moment that I need that again, I extract it.

Each v8 object can gain an internalFieldCount. Then you can add to that. 
Imagine it as a numeric array. You can store either v8::Values or void* inside. 
In my case, I am indeed storing a void* pointer to the Fl_Window instance - and 
keeping it with the v8 object.

The second thing - making a c++ class more v8 aware  - would mean that you have 
one class instance, and just need to manage that. There are other ways to store 
these instances actually.

So, what exactly are you trying to do? ^^;
Am Mi. Jan. 29 2014 00:28:20 schrieb Pierre Saunier:

> thanks, that is clear.
> but that means i have to store a persistent object for every c++ object I 
> create so that i can go from javascript objet to c++ object and vice versa.. 
> . so, either i add the field persistent::object to my class, which links 
> strongly my code to v8 or i need to have an array of persistent, and when i 
> need one javascript object from the c++ object, i look throught the array to 
> find the internal field with the corresponding address (stored each time i 
> create a javascript object).
> Is that right?
>  
> 
> 
> --



-- 
-- 
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/groups/opt_out.

Reply via email to