Skip to content

Commit

Permalink
fixup! Add compatibility with node versions >= 19
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Aug 11, 2023
1 parent 32233bb commit 4e15d45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mbus-master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ NAN_MODULE_INIT(MbusMaster::Init) {

v8::Local<v8::Function> function = Nan::GetFunction(tpl).ToLocalChecked();
constructor.Reset(function);
v8::Local<v8::Context> context = target->GetCreationContext().ToLocalChecked();
#if NODE_MAJOR_VERSION > 18
v8::Local<v8::Context> context = target->GetCreationContextChecked();
#else
v8::Local<v8::Context> context = target->CreationContext();
#endif
target->Set(context, Nan::New("MbusMaster").ToLocalChecked(), function);
}

Expand Down

0 comments on commit 4e15d45

Please sign in to comment.