From 0f37d394b483fe11780bc32ebcc6334e852cb3ea Mon Sep 17 00:00:00 2001 From: Nathan Kunicki Date: Thu, 21 Jun 2018 10:51:39 +0100 Subject: [PATCH] Added Promise return types to jsdoc --- README.md | 12 ++++++------ boosthub.ts | 22 +++++++++++----------- wedo2hub.ts | 16 ++++++++-------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index fb0769c..70cc829 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Emits when a LPF2 Hub device is found. Set the color of the LED on the Hub via a color value. **Kind**: instance method of [BoostHub](#BoostHub) -**Returns**: Promise - - Resolved upon successful completion of command. +**Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | @@ -75,7 +75,7 @@ Set the color of the LED on the Hub via a color value. Set the motor speed on a given port. **Kind**: instance method of [BoostHub](#BoostHub) -**Returns**: Promise - - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. +**Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. | Param | Type | Description | | --- | --- | --- | @@ -89,7 +89,7 @@ Set the motor speed on a given port. Rotate a motor by a given angle. **Kind**: instance method of [BoostHub](#BoostHub) -**Returns**: Promise - - Resolved upon successful completion of command (ie. once the motor is finished). +**Returns**: Promise - Resolved upon successful completion of command (ie. once the motor is finished). | Param | Type | Default | Description | | --- | --- | --- | --- | @@ -217,7 +217,7 @@ Emits when a rotation sensor is activated. Set the color of the LED on the Hub via a color value. **Kind**: instance method of [WeDo2Hub](#WeDo2Hub) -**Returns**: Promise - - Resolved upon successful completion of command. +**Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | @@ -229,7 +229,7 @@ Set the color of the LED on the Hub via a color value. Set the color of the LED on the Hub via RGB values. **Kind**: instance method of [WeDo2Hub](#WeDo2Hub) -**Returns**: Promise - - Resolved upon successful completion of command. +**Returns**: Promise - Resolved upon successful completion of command. | Param | Type | | --- | --- | @@ -243,7 +243,7 @@ Set the color of the LED on the Hub via RGB values. Set the motor speed on a given port. **Kind**: instance method of [WeDo2Hub](#WeDo2Hub) -**Returns**: Promise - - Resolved upon successful completion of command. +**Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | diff --git a/boosthub.ts b/boosthub.ts index cebf104..ab10d0a 100644 --- a/boosthub.ts +++ b/boosthub.ts @@ -57,8 +57,8 @@ export class BoostHub extends Hub { /** * Set the color of the LED on the Hub via a color value. * @method BoostHub#setLEDColor - * @param {number} color - A number representing one of the LED color consts. - * @returns {Promise} - Resolved upon successful completion of command. + * @param {number} color A number representing one of the LED color consts. + * @returns {Promise} Resolved upon successful completion of command. */ public setLEDColor (color: number | boolean) { return new Promise((resolve, reject) => { @@ -92,9 +92,9 @@ export class BoostHub extends Hub { * Set the motor speed on a given port. * @method BoostHub#setMotorSpeed * @param {string} port - * @param {number} speed - For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. - * @param {number} [time] - How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. - * @returns {Promise} - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. + * @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. + * @param {number} [time] How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. + * @returns {Promise} Resolved upon successful completion of command. If time is specified, this is once the motor is finished. */ public setMotorSpeed (port: string, speed: number, time: number) { return new Promise((resolve, reject) => { @@ -123,9 +123,9 @@ export class BoostHub extends Hub { * Rotate a motor by a given angle. * @method BoostHub#setMotorAngle * @param {string} port - * @param {number} angle - How much the motor should be rotated (in degrees). - * @param {number} [speed=100] - How fast the motor should be rotated. - * @returns {Promise} - Resolved upon successful completion of command (ie. once the motor is finished). + * @param {number} angle How much the motor should be rotated (in degrees). + * @param {number} [speed=100] How fast the motor should be rotated. + * @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished). */ public setMotorAngle (port: string, angle: number, speed: number = 100) { return new Promise((resolve, reject) => { @@ -220,7 +220,7 @@ export class BoostHub extends Hub { /** * Emits when a button is pressed. * @event BoostHub#button - * @param {number} state - A number representing one of the button state consts. + * @param {number} state A number representing one of the button state consts. */ this.emit("button", Consts.ButtonStates.PRESSED); return; @@ -286,7 +286,7 @@ export class BoostHub extends Hub { * Emits when a distance sensor is activated. * @event BoostHub#distance * @param {string} port - * @param {number} distance - Distance, in millimeters. + * @param {number} distance Distance, in millimeters. */ this.emit("distance", port.id, distance * 10); break; @@ -298,7 +298,7 @@ export class BoostHub extends Hub { * Emits when a color sensor is activated. * @event BoostHub#color * @param {string} port - * @param {number} color - A number representing one of the LED color consts. + * @param {number} color A number representing one of the LED color consts. */ this.emit("color", port.id, data[4]); diff --git a/wedo2hub.ts b/wedo2hub.ts index e3ec470..90b9ee6 100644 --- a/wedo2hub.ts +++ b/wedo2hub.ts @@ -53,8 +53,8 @@ export class WeDo2Hub extends Hub { /** * Set the color of the LED on the Hub via a color value. * @method WeDo2Hub#setLEDColor - * @param {number} color - A number representing one of the LED color consts. - * @returns {Promise} - Resolved upon successful completion of command. + * @param {number} color A number representing one of the LED color consts. + * @returns {Promise} Resolved upon successful completion of command. */ public setLEDColor (color: number | boolean) { return new Promise((resolve, reject) => { @@ -80,7 +80,7 @@ export class WeDo2Hub extends Hub { * @param {number} red * @param {number} green * @param {number} blue - * @returns {Promise} - Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful completion of command. */ public setLEDRGB (red: number, green: number, blue: number) { return new Promise((resolve, reject) => { @@ -101,8 +101,8 @@ export class WeDo2Hub extends Hub { * Set the motor speed on a given port. * @method WeDo2Hub#setMotorSpeed * @param {string} port - * @param {number} speed - For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. - * @returns {Promise} - Resolved upon successful completion of command. + * @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. + * @returns {Promise} Resolved upon successful completion of command. */ public setMotorSpeed (port: string, speed: number) { return new Promise((resolve, reject) => { @@ -169,7 +169,7 @@ export class WeDo2Hub extends Hub { /** * Emits when a button is pressed. * @event WeDo2Hub#button - * @param {number} state - A number representing one of the button state consts. + * @param {number} state A number representing one of the button state consts. */ this.emit("button", Consts.ButtonStates.PRESSED); return; @@ -196,7 +196,7 @@ export class WeDo2Hub extends Hub { * Emits when a distance sensor is activated. * @event WeDo2Hub#distance * @param {string} port - * @param {number} distance - Distance, in millimeters. + * @param {number} distance Distance, in millimeters. */ this.emit("distance", port.id, distance * 10); break; @@ -208,7 +208,7 @@ export class WeDo2Hub extends Hub { * Emits when a color sensor is activated. * @event WeDo2Hub#color * @param {string} port - * @param {number} color - A number representing one of the LED color consts. + * @param {number} color A number representing one of the LED color consts. */ this.emit("color", port.id, distance); break;