| 163 | } |
| 164 | |
| 165 | NAN_MODULE_INIT(Init) { |
| 166 | SetMethod(target, "testWithData", TestWithData, New("test-value").ToLocalChecked()); |
| 167 | |
| 168 | v8::Local<v8::FunctionTemplate> tpl = |
| 169 | Nan::New<v8::FunctionTemplate>(SetterGetter::New, New("new-data").ToLocalChecked()); |
| 170 | settergetter_constructor.Reset(tpl); |
| 171 | tpl->SetClassName(Nan::New<v8::String>("SetterGetter").ToLocalChecked()); |
| 172 | tpl->InstanceTemplate()->SetInternalFieldCount(1); |
| 173 | SetPrototypeMethod( |
| 174 | tpl, |
| 175 | "log", |
| 176 | SetterGetter::Log, |
| 177 | Nan::New("log-data").ToLocalChecked()); |
| 178 | v8::Local<v8::ObjectTemplate> itpl = tpl->InstanceTemplate(); |
| 179 | SetAccessor( |
| 180 | itpl |
| 181 | , Nan::New("prop1").ToLocalChecked() |
| 182 | , SetterGetter::GetProp1 |
| 183 | , 0 |
| 184 | , Nan::New("prop1-data").ToLocalChecked()); |
| 185 | SetAccessor( |
| 186 | itpl |
| 187 | , Nan::New<v8::String>("prop2").ToLocalChecked() |
| 188 | , SetterGetter::GetProp2 |
| 189 | , SetterGetter::SetProp2 |
| 190 | , Nan::New("prop2-data").ToLocalChecked() |
| 191 | ); |
| 192 | |
| 193 | v8::Local<v8::Function> createnew = |
| 194 | Nan::GetFunction( |
| 195 | Nan::New<v8::FunctionTemplate>( |
| 196 | CreateNew, Nan::New("create-data").ToLocalChecked())).ToLocalChecked(); |
| 197 | Set(target, Nan::New<v8::String>("create").ToLocalChecked(), createnew); |
| 198 | } |
| 199 | |
| 200 | NODE_MODULE(methodswithdata, Init) |
nothing calls this directly
no test coverage detected