Handle<Value> Window::New(const Arguments& args) { HandleScope scope; Persistent<Object> options = Persistent<Object>::New(args[0]->ToObject()); Settings* settings = new Settings(options); NativeWindow* window = new NativeWindow(settings); Persistent<Object> self = Persistent<Object>::New(args.This()); window->SetV8Handle(self); self->SetPointerInInternalField(0, window); return scope.Close(args.This()); }
Handle<Value> Window::New(const Arguments& args) { HandleScope scope; Handle<Object> self = Persistent<Object>::New(args.This()); char* url = (args[0]->IsString()) ? V8StringToChar(args[0]->ToString()) : (char*) "/"; Persistent<Object> windowSettings = Persistent<Object>::New((args[1]->IsObject()) ? args[1]->ToObject() : Object::New()); Settings* settings = new Settings(windowSettings); NativeWindow* window = new NativeWindow(url, settings); window->SetV8Handle(self); self->SetPointerInInternalField (0, window); return scope.Close(args.This()); }