| 35 | } |
| 36 | |
| 37 | NAN_MODULE_INIT(MyObject::Init) { |
| 38 | // Prepare constructor template |
| 39 | v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New); |
| 40 | tpl->SetClassName(Nan::New<v8::String>("MyObject").ToLocalChecked()); |
| 41 | tpl->InstanceTemplate()->SetInternalFieldCount(1); |
| 42 | |
| 43 | SetPrototypeMethod(tpl, "call_emit", CallEmit); |
| 44 | |
| 45 | v8::Local<v8::Function> function = GetFunction(tpl).ToLocalChecked(); |
| 46 | constructor.Reset(function); |
| 47 | Set(target, Nan::New("MyObject").ToLocalChecked(), function); |
| 48 | } |
| 49 | |
| 50 | NAN_METHOD(MyObject::New) { |
| 51 | if (info.IsConstructCall()) { |
nothing calls this directly
no test coverage detected