From d724a29b1d1c43ab0702099d31fbe589a3aea48a Mon Sep 17 00:00:00 2001 From: Ingo Fischer Date: Thu, 9 May 2024 13:49:48 +0200 Subject: [PATCH] try get away other callback deprecations --- src/mbus-master.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mbus-master.cc b/src/mbus-master.cc index 9be04f0..93c959a 100644 --- a/src/mbus-master.cc +++ b/src/mbus-master.cc @@ -405,7 +405,7 @@ NAN_METHOD(MbusMaster::Get) { char *address = get(Nan::To(info[0]).ToLocalChecked(),"0"); bool ping_first = Nan::To(info[1]).FromJust(); - Nan::Callback *callback = obj->connected ? new Nan::Callback(info[2].As()) : new Nan::Call(info[2].As()); + Nan::Callback *callback = new Nan::Callback(info[2].As()); if(obj->connected) { obj->communicationInProgress = true; @@ -415,7 +415,7 @@ NAN_METHOD(MbusMaster::Get) { Local argv[] = { Nan::Error("Not connected to port") }; - callback->Call(1, argv); + Nan::Call(callback, 1, argv); } info.GetReturnValue().SetUndefined(); } @@ -610,7 +610,7 @@ NAN_METHOD(MbusMaster::ScanSecondary) { MbusMaster* obj = node::ObjectWrap::Unwrap(info.This()); - Nan::Callback *callback = obj->connected ? new Nan::Callback(info[0].As()) : new Nan::Call(info[0].As()); + Nan::Callback *callback = new Nan::Callback(info[0].As()); if(obj->connected) { obj->communicationInProgress = true; @@ -619,7 +619,7 @@ NAN_METHOD(MbusMaster::ScanSecondary) { Local argv[] = { Nan::Error("Not connected to port") }; - callback->Call(1, argv); + Nan::Call(callback, 1, argv); } info.GetReturnValue().SetUndefined(); } @@ -797,7 +797,7 @@ NAN_METHOD(MbusMaster::SetPrimaryId) { char *oldAddress = get(Nan::To(info[0]).ToLocalChecked(),"0"); int newAddress = (int)Nan::To(info[1]).FromJust(); - Nan::Callback *callback = obj->connected ? new Nan::Callback(info[2].As()) : new Nan::Call(info[2].As()); + Nan::Callback *callback = new Nan::Callback(info[2].As()); if(obj->connected) { obj->communicationInProgress = true; @@ -806,7 +806,7 @@ NAN_METHOD(MbusMaster::SetPrimaryId) { Local argv[] = { Nan::Error("Not connected to port") }; - callback->Call(1, argv); + Nan::Call(callback, 1, argv); } info.GetReturnValue().SetUndefined(); }