Added Promise return types to jsdoc
This commit is contained in:
parent
11556bf292
commit
9ab009b5b4
30
README.md
30
README.md
@ -45,9 +45,9 @@ Emits when a LPF2 Hub device is found.
|
||||
**Extends**: [<code>Hub</code>](#Hub)
|
||||
|
||||
* [BoostHub](#BoostHub) ⇐ [<code>Hub</code>](#Hub)
|
||||
* [.setLEDColor(color)](#BoostHub+setLEDColor)
|
||||
* [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed)
|
||||
* [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle)
|
||||
* [.setLEDColor(color)](#BoostHub+setLEDColor) ⇒ <code>Promise</code>
|
||||
* [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed) ⇒ <code>Promise</code>
|
||||
* [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle) ⇒ <code>Promise</code>
|
||||
* [.connect([callback])](#Hub+connect)
|
||||
* [.subscribe(port, [mode])](#Hub+subscribe)
|
||||
* [.unsubscribe(port)](#Hub+unsubscribe)
|
||||
@ -59,10 +59,11 @@ Emits when a LPF2 Hub device is found.
|
||||
|
||||
<a name="BoostHub+setLEDColor"></a>
|
||||
|
||||
### boostHub.setLEDColor(color)
|
||||
### boostHub.setLEDColor(color) ⇒ <code>Promise</code>
|
||||
Set the color of the LED on the Hub via a color value.
|
||||
|
||||
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
|
||||
**Returns**: <code>Promise</code> - - Resolved upon successful completion of command.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
@ -70,10 +71,11 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
<a name="BoostHub+setMotorSpeed"></a>
|
||||
|
||||
### boostHub.setMotorSpeed(port, speed, [time])
|
||||
### boostHub.setMotorSpeed(port, speed, [time]) ⇒ <code>Promise</code>
|
||||
Set the motor speed on a given port.
|
||||
|
||||
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
|
||||
**Returns**: <code>Promise</code> - - Resolved upon successful completion of command. If time is specified, this is once the motor is finished.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
@ -83,10 +85,11 @@ Set the motor speed on a given port.
|
||||
|
||||
<a name="BoostHub+setMotorAngle"></a>
|
||||
|
||||
### boostHub.setMotorAngle(port, angle, [speed])
|
||||
### boostHub.setMotorAngle(port, angle, [speed]) ⇒ <code>Promise</code>
|
||||
Rotate a motor by a given angle.
|
||||
|
||||
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
|
||||
**Returns**: <code>Promise</code> - - Resolved upon successful completion of command (ie. once the motor is finished).
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
@ -196,9 +199,9 @@ Emits when a rotation sensor is activated.
|
||||
**Extends**: [<code>Hub</code>](#Hub)
|
||||
|
||||
* [WeDo2Hub](#WeDo2Hub) ⇐ [<code>Hub</code>](#Hub)
|
||||
* [.setLEDColor(color)](#WeDo2Hub+setLEDColor)
|
||||
* [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB)
|
||||
* [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed)
|
||||
* [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ <code>Promise</code>
|
||||
* [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ <code>Promise</code>
|
||||
* [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed) ⇒ <code>Promise</code>
|
||||
* [.connect([callback])](#Hub+connect)
|
||||
* [.subscribe(port, [mode])](#Hub+subscribe)
|
||||
* [.unsubscribe(port)](#Hub+unsubscribe)
|
||||
@ -210,10 +213,11 @@ Emits when a rotation sensor is activated.
|
||||
|
||||
<a name="WeDo2Hub+setLEDColor"></a>
|
||||
|
||||
### weDo2Hub.setLEDColor(color)
|
||||
### weDo2Hub.setLEDColor(color) ⇒ <code>Promise</code>
|
||||
Set the color of the LED on the Hub via a color value.
|
||||
|
||||
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
|
||||
**Returns**: <code>Promise</code> - - Resolved upon successful completion of command.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
@ -221,10 +225,11 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
<a name="WeDo2Hub+setLEDRGB"></a>
|
||||
|
||||
### weDo2Hub.setLEDRGB(red, green, blue)
|
||||
### weDo2Hub.setLEDRGB(red, green, blue) ⇒ <code>Promise</code>
|
||||
Set the color of the LED on the Hub via RGB values.
|
||||
|
||||
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
|
||||
**Returns**: <code>Promise</code> - - Resolved upon successful completion of command.
|
||||
|
||||
| Param | Type |
|
||||
| --- | --- |
|
||||
@ -234,10 +239,11 @@ Set the color of the LED on the Hub via RGB values.
|
||||
|
||||
<a name="WeDo2Hub+setMotorSpeed"></a>
|
||||
|
||||
### weDo2Hub.setMotorSpeed(port, speed)
|
||||
### weDo2Hub.setMotorSpeed(port, speed) ⇒ <code>Promise</code>
|
||||
Set the motor speed on a given port.
|
||||
|
||||
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
|
||||
**Returns**: <code>Promise</code> - - Resolved upon successful completion of command.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
|
@ -58,6 +58,7 @@ 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.
|
||||
*/
|
||||
public setLEDColor (color: number | boolean) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -93,6 +94,7 @@ export class BoostHub extends Hub {
|
||||
* @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.
|
||||
*/
|
||||
public setMotorSpeed (port: string, speed: number, time: number) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -123,6 +125,7 @@ export class BoostHub extends Hub {
|
||||
* @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).
|
||||
*/
|
||||
public setMotorAngle (port: string, angle: number, speed: number = 100) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -54,6 +54,7 @@ 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.
|
||||
*/
|
||||
public setLEDColor (color: number | boolean) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -79,6 +80,7 @@ export class WeDo2Hub extends Hub {
|
||||
* @param {number} red
|
||||
* @param {number} green
|
||||
* @param {number} blue
|
||||
* @returns {Promise} - Resolved upon successful completion of command.
|
||||
*/
|
||||
public setLEDRGB (red: number, green: number, blue: number) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -100,6 +102,7 @@ export class WeDo2Hub extends Hub {
|
||||
* @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.
|
||||
*/
|
||||
public setMotorSpeed (port: string, speed: number) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user