MadLittleMods / node-usb-detection

List USB devices in system and detect changes on them.
MIT License
370 stars 114 forks source link

Node 13 support #91

Closed kryops closed 4 years ago

kryops commented 4 years ago

When building for Node 13, a lot of errors pop up about v8::Object::Set:

../src/detection.cpp: In function 'void NotifyAdded(ListResultItem_t*)':
../src/detection.cpp:51:113: error: no matching function for call to 'v8::Object::Set(v8::Local<v8::String>, Nan::imp::FactoryBase<v8::Number>::return_t)'
   51 |   item->Set(Nan::New<v8::String>(OBJECT_ITEM_LOCATION_ID).ToLocalChecked(), Nan::New<v8::Number>(it->locationId));
      |

(Node 13.0.1, Arch Linux 5.3.7)

If I understand this correctly, these calls can be replaced by Nan::Set to ensure compatibility across different Node/V8 versions: https://github.com/nodejs/nan/blob/master/doc/maybe_types.md#api_nan_set

I will open a PR for this shortly.