Upgrade nan for node 19.x support (#853)

This commit is contained in:
Michael Nutt
2023-02-24 02:30:01 +09:00
committed by GitHub
parent b287e18eff
commit 9212dad121
4 changed files with 17 additions and 2 deletions

View File

@@ -27,7 +27,11 @@ NodeRequest::~NodeRequest() {
Nan::Persistent<v8::Function> NodeRequest::constructor;
void NodeRequest::Init(v8::Local<v8::Object> target) {
#if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 93
v8::Local<v8::Context> context = target->CreationContext();
#else
v8::Local<v8::Context> context = target->GetCreationContext().ToLocalChecked();
#endif
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);