v8::Local<v8::Value> SetterGetter::NewInstance () { EscapableHandleScope scope; v8::Local<v8::FunctionTemplate> constructorHandle = Nan::New(settergetter_constructor); v8::Local<v8::Object> instance = constructorHandle->GetFunction()->NewInstance(0, NULL); return scope.Escape(instance); }
v8::Local<v8::Value> IndexedInterceptor::NewInstance () { EscapableHandleScope scope; v8::Local<v8::FunctionTemplate> constructorHandle = Nan::New(indexedinterceptors_constructor); v8::Local<v8::Object> instance = Nan::NewInstance(constructorHandle->GetFunction()).ToLocalChecked(); return scope.Escape(instance); }
v8::Local<v8::Value> NamedInterceptor::NewInstance () { EscapableHandleScope scope; v8::Local<v8::FunctionTemplate> constructorHandle = Nan::New(namedinterceptors_constructor); v8::Local<v8::Object> instance = constructorHandle->GetFunction()->NewInstance(0, NULL); return scope.Escape(instance); }
v8::Local<v8::String> wrap(v8::Local<v8::Function> func) { EscapableHandleScope scope; v8::Local<v8::String> lstring = New<v8::String>("result").ToLocalChecked(); int *parameter = new int(42); Persistent<v8::Function> persistent(func); persistent.SetWeak(parameter, weakCallback, WeakCallbackType::kParameter); assert(persistent.IsWeak()); return scope.Escape(lstring); }
v8::Local<v8::String> wrap() { EscapableHandleScope scope; v8::Local<v8::String> lstring = New("result").ToLocalChecked(); v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>(); otpl->SetInternalFieldCount(1); v8::Local<v8::Object> obj = otpl->NewInstance(); SetInternalFieldPointer(obj, 0, new int(42)); Persistent<v8::Object> persistent(obj); persistent.SetWeak( static_cast<int*>(0) , weakCallback , WeakCallbackType::kInternalFields); assert(persistent.IsWeak()); return scope.Escape(lstring); }
v8::Local<v8::Value> SetterGetter::NewInstance () { EscapableHandleScope scope; v8::Local<v8::FunctionTemplate> constructorHandle = Nan::New(settergetter_constructor); v8::Local<v8::Object> instance = constructorHandle->GetFunction()->NewInstance(0, NULL); SetAccessor( instance , Nan::New("prop1").ToLocalChecked() , SetterGetter::GetProp1); SetAccessor( instance , Nan::New<v8::String>("prop2").ToLocalChecked() , SetterGetter::GetProp2 , SetterGetter::SetProp2 ); return scope.Escape(instance); }