Yes. Arguments::Data() holds the DATA value passed to  
FunctionTemplate::New(call, DATA);

You can use this to pass the instance the function should operate on,  
or even an object that contains the C++ function to eventually call.

It is not, however, the proper way to tie a function of a JavaScript  
object instance to a native-side object instance. In those situations,  
you'd use Arguments::This(), which is a handle to a V8 object that  
could then wrap a native object in its internal field.

If you are mapping a global JavaScript function to a member of a  
native class, however, it would be good to use Arguments::Data().

Alex

On Feb 26, 2009, at 1:21 PM, Stephan Beal wrote:

>
> On Feb 26, 8:14 pm, Joe Antoon <[email protected]> wrote:
>> I'm new to v8 as well.  As for the arguments, they can be treated as
>> an array of Local<Value>'s..
>
> That i've got, but i'm looking to tie *native* ("External") data to a
> function, and the undocumented Arguments::Data() member would *seem*
> to allow me to do that via FunctionTemplate::New()'s second
> (undocumented) parameter. i haven't yet fished out the implementation
> code to follow that assumption through, though, and the API docs are
> empty for Data()/New(...,Handle<Value>,...).
>
>> If you need an example, check out shell.cc in the samples folder of
>> the v8 package.  It wraps a few c++ functions (print, etc) and binds
>> them to the global object.
>
> That example unfortunately relies on the default value of the second
> arg to FunctionTemplate::New(), so i'm still fuzzy on what that
> argument is really for.
>
> >





--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to