Local<FunctionTemplate> tmpl = FunctionTemplate::New(isolate, [](const FunctionCallbackInfo<Value> &info) {
Isolate* isolate = info.GetIsolate();
// Associate some custom C++ data with the instance created through this function
info.This()->SetInternalField(0, External::New(isolate, nullptr));
});
tmpl->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func = tmpl->GetFunction(context).ToLocalChecked();
Local<Object> instance = func->NewInstance(context).ToLocalChecked();
// Getting back the C++ data associated with the instance
Local<External> extData = instance->GetInternalField(0).As<External>();func->SetInternalField(0, External::New(isolate, nullptr));