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 2d2fcd8 commit cc8604d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mbus-master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,18 @@ 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 = new Nan::Callback(info[2].As<Function>());

if(obj->connected) {
obj->communicationInProgress = true;

Nan::Callback *callback = new Nan::Callback(info[2].As<Function>());
Nan::AsyncQueueWorker(new RecieveWorker(callback, address, ping_first, &(obj->queueLock), obj->handle, &(obj->communicationInProgress)));
} else {
Local<Value> argv[] = {
Nan::Error("Not connected to port")
};

Nan::Call *callback = new Nan::Call(info[2].As<Function>());
callback->Call(1, argv);
}
info.GetReturnValue().SetUndefined();
Expand Down Expand Up @@ -801,7 +803,7 @@ NAN_METHOD(MbusMaster::SetPrimaryId) {
if(obj->connected) {
obj->communicationInProgress = true;

Nan::Callback *callback = new Nan::Callback(info[2].As<Function>());
Nan::Callback *callback = new Nan::Callback(info[2].As<Function>());
Nan::AsyncQueueWorker(new SetPrimaryWorker(callback, oldAddress, newAddress, &(obj->queueLock), obj->handle, &(obj->communicationInProgress)));
} else {
Local<Value> argv[] = {
Expand Down

0 comments on commit cc8604d

Please sign in to comment.