| 42 | } |
| 43 | |
| 44 | NAN_MODULE_INIT(SetterGetter::Init) { |
| 45 | v8::Local<v8::FunctionTemplate> tpl = |
| 46 | Nan::New<v8::FunctionTemplate>(SetterGetter::New); |
| 47 | settergetter_constructor.Reset(tpl); |
| 48 | tpl->SetClassName(Nan::New<v8::String>("SetterGetter").ToLocalChecked()); |
| 49 | tpl->InstanceTemplate()->SetInternalFieldCount(1); |
| 50 | SetPrototypeMethod(tpl, "log", SetterGetter::Log); |
| 51 | v8::Local<v8::ObjectTemplate> itpl = tpl->InstanceTemplate(); |
| 52 | SetAccessor( |
| 53 | itpl |
| 54 | , Nan::New("prop1").ToLocalChecked() |
| 55 | , SetterGetter::GetProp1); |
| 56 | SetAccessor( |
| 57 | itpl |
| 58 | , Nan::New<v8::String>("prop2").ToLocalChecked() |
| 59 | , SetterGetter::GetProp2 |
| 60 | , SetterGetter::SetProp2 |
| 61 | ); |
| 62 | |
| 63 | v8::Local<v8::Function> createnew = |
| 64 | Nan::GetFunction( |
| 65 | Nan::New<v8::FunctionTemplate>(CreateNew)).ToLocalChecked(); |
| 66 | Set(target, Nan::New<v8::String>("create").ToLocalChecked(), createnew); |
| 67 | } |
| 68 | |
| 69 | v8::Local<v8::Value> SetterGetter::NewInstance () { |
| 70 | EscapableHandleScope scope; |
nothing calls this directly
no test coverage detected