I’d like to be able to access the Arguments& args of a callback. Right now when I set the C++ function to be called from the JavaScript side it looks like this:
global->Set(String::New("login"), FunctionTemplate::New(Login));
And the prototype of the C++ function is:
Handle<Value> MyClass::Login(const Arguments& args)
How do I access this Arguments& args so that I can pass in a variable when the callback occurs? Thanks for the help.
v8::Arguments::Length()will return the number of arguments passed from JavaScript. Thev8::Arguments&variable is accessed using an array subscript.You will find an online version of the
v8::Argumentsdocumentation at http://izs.me/v8-docs/classv8_1_1Arguments.html, however I make no guarantees that it is current or will remain online.Running the following command from the top of the V8 source tree will generate the documentation locally using doxygen.
If doxygen executes successfully you can access the documentation in
include/html/index.html.