Skip to content

Commit 8d98909

Browse files
committed
fix: exported methods
1 parent 55e92ea commit 8d98909

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

nodehid.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ function HID() {
5555
`this._raw`
5656
*/
5757
for(var i in binding.HID.prototype)
58-
if(i != "close" && i != "read")
59-
this[i] = binding.HID.prototype[i].bind(this._raw);
58+
this[i] = binding.HID.prototype[i].bind(this._raw);
6059

6160
/* We are now done inheriting from `binding.HID` and EventEmitter.
6261
@@ -132,4 +131,3 @@ function showdevices() {
132131
exports.HID = HID;
133132
exports.devices = showdevices;
134133
exports.setDriverType = setDriverType;
135-
// exports.devices = binding.devices;

src/HID.cc

+7-8
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ Napi::Value HID::readSync(const Napi::CallbackInfo &info)
203203

204204
unsigned char buff_read[READ_BUFF_MAXSIZE];
205205
int returnedLength = hid_read(_hidHandle, buff_read, sizeof buff_read);
206-
207206
if (returnedLength == -1)
208207
{
209208
Napi::TypeError::New(env, "could not read data from device").ThrowAsJavaScriptException();
@@ -533,13 +532,13 @@ void HID::Initialize(Napi::Env &env, Napi::Object &exports)
533532
Napi::Function ctor = DefineClass(env, "HID", {
534533
InstanceMethod("close", &HID::close),
535534
InstanceMethod("read", &HID::read),
536-
InstanceMethod("write", &HID::write),
537-
InstanceMethod("getFeatureReport", &HID::getFeatureReport),
538-
InstanceMethod("sendFeatureReport", &HID::sendFeatureReport),
539-
InstanceMethod("setNonBlocking", &HID::setNonBlocking),
540-
InstanceMethod("readSync", &HID::readSync),
541-
InstanceMethod("readTimeout", &HID::readTimeout),
542-
InstanceMethod("getDeviceInfo", &HID::getDeviceInfo),
535+
InstanceMethod("write", &HID::write, napi_enumerable),
536+
InstanceMethod("getFeatureReport", &HID::getFeatureReport, napi_enumerable),
537+
InstanceMethod("sendFeatureReport", &HID::sendFeatureReport, napi_enumerable),
538+
InstanceMethod("setNonBlocking", &HID::setNonBlocking, napi_enumerable),
539+
InstanceMethod("readSync", &HID::readSync, napi_enumerable),
540+
InstanceMethod("readTimeout", &HID::readTimeout, napi_enumerable),
541+
InstanceMethod("getDeviceInfo", &HID::getDeviceInfo, napi_enumerable),
543542
});
544543

545544
exports.Set("HID", ctor);

0 commit comments

Comments
 (0)