Пример #1
0
void ScriptFunction::callCallback(
    const v8::FunctionCallbackInfo<v8::Value>& args) {
  ASSERT(args.Data()->IsExternal());
  ScriptFunction* scriptFunction = static_cast<ScriptFunction*>(
      v8::Local<v8::External>::Cast(args.Data())->Value());
  ScriptValue result = scriptFunction->call(
      ScriptValue(scriptFunction->getScriptState(), args[0]));
  v8SetReturnValue(args, result.v8Value());
}
Пример #2
0
void ScriptFunction::callCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
    v8::Isolate* isolate = args.GetIsolate();
    ASSERT(!args.Data().IsEmpty());
    ScriptFunction* function = ScriptFunction::Cast(args.Data());
    v8::Local<v8::Value> value = args.Length() > 0 ? args[0] : v8::Local<v8::Value>(v8::Undefined(isolate));

    ScriptValue result = function->call(ScriptValue(ScriptState::current(isolate), value));

    v8SetReturnValue(args, result.v8Value());
}