// Call a JavaScript function with no arguments Localfunc = Local ::Cast(obj->Get(String::NewFromUtf8(isolate, "myFunction"))); CallArgs args; func->Call(isolate->GetCurrentContext(), obj, 0, args);
// Call a JavaScript function with one argument Localfunc = Local ::Cast(obj->Get(String::NewFromUtf8(isolate, "myFunction"))); CallArgs args; args[0] = String::NewFromUtf8(isolate, "hello"); func->Call(isolate->GetCurrentContext(), obj, args.Length(), args);
// Call a JavaScript function with multiple arguments LocalIn this example, we get a reference to a JavaScript function called "myFunction" and then call it with two arguments (a string literal and an integer) using CallArgs. Based on the package name and the fact that it is designed to be used with the V8 engine, I would guess that the library is part of the V8 engine itself. The documentation for CallArgs can be found on the V8 website.func = Local ::Cast(obj->Get(String::NewFromUtf8(isolate, "myFunction"))); CallArgs args; args[0] = String::NewFromUtf8(isolate, "hello"); args[1] = Integer::New(isolate, 123); func->Call(isolate->GetCurrentContext(), obj, args.Length(), args);