I think what you need is: ObjectTemplate::SetIndexedPropertyHandler


On Wednesday, October 30, 2013 8:39:54 PM UTC+2, Flying Jester wrote:
>
> Let's say I have an object on the C++ side that is wrapped for use in JS. 
> It has several member functions attached to its prototype. Is there a way 
> to allow this object to be used, for instance, just like an array as well 
> on the JS side, which will access values specified on the C++ side?
>
> Like this:
> (js)
>
> var byteArrayObject = new byteArray("Some String"); //constructor defined 
> in C++. It now holds the string as a series of bytes.
>
> var stringy = byteArrayObject.CreateString(); //stringy now holds "Some 
> String". This is simple to make work.
>
> var thirdCharacter = byteArrayObject[2]; //thirdCharacter holds "m".
>
> (/js)
>
> How would this be done? Is there a way to modify how operators like 
> brackets (or more generally, any operator) on the JS side handle objects 
> created from constructors that are defined in C++?
>

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