Skip to content

Commit

Permalink
Merge pull request #185 from robertsLando/patch-1
Browse files Browse the repository at this point in the history
Fixed TypeError when calling .open the second time
  • Loading branch information
yaacov authored Feb 9, 2018
2 parents 5f1cd2f + 90b5384 commit aea1be9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,21 +342,23 @@ ModbusRTU.prototype.open = function(callback) {
callback(error);
}
});
};


/**
* Check if port is open
*/
Object.defineProperty(this, "isOpen", {
enumerable: true,
get: function() {
if (this._port) {
return this._port.isOpen;
}

return false;
/**
* Check if port is open
*/
Object.defineProperty(ModbusRTU.prototype, "isOpen", {
enumerable: true,
get: function() {
if (this._port) {
return this._port.isOpen;
}
});
};

return false;
}
});


/**
* Close the serial port
Expand Down

0 comments on commit aea1be9

Please sign in to comment.