コード例 #1
0
Handle<Value> StringDistanceJs::New(const Arguments& args) {
  HandleScope scope;

  QString className = str(args.This()->GetConstructorName());

  StringDistance* c = Factory::getInstance().constructObject<StringDistance>(className);
  StringDistanceJs* obj = new StringDistanceJs(StringDistancePtr(c));
  obj->Wrap(args.This());

  PopulateConsumersJs::populateConsumers<StringDistance>(c, args);

  return args.This();
}
コード例 #2
0
void StringDistanceJs::New(const FunctionCallbackInfo<Value>& args)
{
  HandleScope scope(args.GetIsolate());

  QString className = str(args.This()->GetConstructorName());

  StringDistance* c = Factory::getInstance().constructObject<StringDistance>(className);
  StringDistanceJs* obj = new StringDistanceJs(StringDistancePtr(c));
  //  node::ObjectWrap::Wrap takes ownership of the pointer in a v8::Persistent<v8::Object>
  obj->Wrap(args.This());

  PopulateConsumersJs::populateConsumers<StringDistance>(c, args);

  args.GetReturnValue().Set(args.This());
}