koalazak / dorita980

Unofficial iRobot Roomba and Braava (i7/i7+, 980, 960, 900, e5, 690, 675, m6, etc) node.js library (SDK) to control your robot
MIT License
931 stars 147 forks source link

Added Types #167

Closed bloomkd46 closed 1 year ago

bloomkd46 commented 1 year ago

Added types based off of the documentation to make library more user-friendly.

bloomkd46 commented 1 year ago

Note: it will now generate an error if you try to initialize dorita980 with new. To fix this just don't use the new keyword when initializing dorita980.

example:

var dorita980 = require('dorita980');

var myRobotViaLocal = new dorita980.Local('MyUsernameBlid', 'MyPassword', '192.168.1.104'); // robot IP address

myRobotViaLocal.on('connect', init);

function init () {
  myRobotViaLocal.clean()
  .then(() => myRobotViaLocal.end()) // disconnect to leave free the channel for the mobile app.
  .catch(console.log);
}

turns into

var dorita980 = require('dorita980');

var myRobotViaLocal = /*new*/ dorita980.Local('MyUsernameBlid', 'MyPassword', '192.168.1.104'); // robot IP address

myRobotViaLocal.on('connect', init);

function init () {
  myRobotViaLocal.clean()
  .then(() => myRobotViaLocal.end()) // disconnect to leave free the channel for the mobile app.
  .catch(console.log);
}
bloomkd46 commented 1 year ago

@koalazak, this pull request has now been finished and is ready for merging

bloomkd46 commented 1 year ago

Need to change Pick<>’s to interface[key]’s

bloomkd46 commented 1 year ago

I am deleting my fork and re-creating it to hopefully fix the messy git history