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(); }
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()); }