Skip to content

Commit

Permalink
try get away other callback deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed May 9, 2024
1 parent 9cce2e3 commit d724a29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mbus-master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ NAN_METHOD(MbusMaster::Get) {

char *address = get(Nan::To<v8::String>(info[0]).ToLocalChecked(),"0");
bool ping_first = Nan::To<bool>(info[1]).FromJust();
Nan::Callback *callback = obj->connected ? new Nan::Callback(info[2].As<Function>()) : new Nan::Call(info[2].As<Function>());
Nan::Callback *callback = new Nan::Callback(info[2].As<Function>());

if(obj->connected) {
obj->communicationInProgress = true;
Expand All @@ -415,7 +415,7 @@ NAN_METHOD(MbusMaster::Get) {
Local<Value> argv[] = {
Nan::Error("Not connected to port")
};
callback->Call(1, argv);
Nan::Call(callback, 1, argv);
}
info.GetReturnValue().SetUndefined();
}
Expand Down Expand Up @@ -610,7 +610,7 @@ NAN_METHOD(MbusMaster::ScanSecondary) {

MbusMaster* obj = node::ObjectWrap::Unwrap<MbusMaster>(info.This());

Nan::Callback *callback = obj->connected ? new Nan::Callback(info[0].As<Function>()) : new Nan::Call(info[0].As<Function>());
Nan::Callback *callback = new Nan::Callback(info[0].As<Function>());
if(obj->connected) {
obj->communicationInProgress = true;

Expand All @@ -619,7 +619,7 @@ NAN_METHOD(MbusMaster::ScanSecondary) {
Local<Value> argv[] = {
Nan::Error("Not connected to port")
};
callback->Call(1, argv);
Nan::Call(callback, 1, argv);
}
info.GetReturnValue().SetUndefined();
}
Expand Down Expand Up @@ -797,7 +797,7 @@ NAN_METHOD(MbusMaster::SetPrimaryId) {

char *oldAddress = get(Nan::To<v8::String>(info[0]).ToLocalChecked(),"0");
int newAddress = (int)Nan::To<int64_t>(info[1]).FromJust();
Nan::Callback *callback = obj->connected ? new Nan::Callback(info[2].As<Function>()) : new Nan::Call(info[2].As<Function>());
Nan::Callback *callback = new Nan::Callback(info[2].As<Function>());
if(obj->connected) {
obj->communicationInProgress = true;

Expand All @@ -806,7 +806,7 @@ NAN_METHOD(MbusMaster::SetPrimaryId) {
Local<Value> argv[] = {
Nan::Error("Not connected to port")
};
callback->Call(1, argv);
Nan::Call(callback, 1, argv);
}
info.GetReturnValue().SetUndefined();
}
Expand Down

0 comments on commit d724a29

Please sign in to comment.