From 3a413953db705183bb177040c07e3034ba174b0e Mon Sep 17 00:00:00 2001 From: Nathan Kunicki Date: Thu, 21 Jun 2018 18:27:50 +0100 Subject: [PATCH] More documentation --- DOCS.md | 40 ++++++++++++++++++++++++---------------- README.md | 40 ++++++++++++++++++++++++---------------- package.json | 1 + 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/DOCS.md b/DOCS.md index 2407ac7..55f2f83 100644 --- a/DOCS.md +++ b/DOCS.md @@ -45,13 +45,13 @@ Emits when a LPF2 Hub device is found. **Extends**: [Hub](#Hub) * [BoostHub](#BoostHub) ⇐ [Hub](#Hub) - * [.setLEDColor(color)](#BoostHub+setLEDColor) - * [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed) - * [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle) + * [.setLEDColor(color)](#BoostHub+setLEDColor) ⇒ Promise + * [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed) ⇒ Promise + * [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle) ⇒ Promise * [.connect([callback])](#Hub+connect) * [.subscribe(port, [mode])](#Hub+subscribe) * [.unsubscribe(port)](#Hub+unsubscribe) - * ["button" (state)](#BoostHub+event_button) + * ["button" (button, state)](#BoostHub+event_button) * ["distance" (port, distance)](#BoostHub+event_distance) * ["color" (port, color)](#BoostHub+event_color) * ["tilt" (port, x, y)](#BoostHub+event_tilt) @@ -59,10 +59,11 @@ Emits when a LPF2 Hub device is found. -### boostHub.setLEDColor(color) +### boostHub.setLEDColor(color) ⇒ Promise 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. | Param | Type | Description | | --- | --- | --- | @@ -70,10 +71,11 @@ Set the color of the LED on the Hub via a color value. -### boostHub.setMotorSpeed(port, speed, [time]) +### boostHub.setMotorSpeed(port, speed, [time]) ⇒ Promise 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. | Param | Type | Description | | --- | --- | --- | @@ -83,10 +85,11 @@ Set the motor speed on a given port. -### boostHub.setMotorAngle(port, angle, [speed]) +### boostHub.setMotorAngle(port, angle, [speed]) ⇒ Promise 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). | Param | Type | Default | Description | | --- | --- | --- | --- | @@ -131,13 +134,14 @@ Unsubscribe to sensor notifications on a given port. -### "button" (state) +### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [BoostHub](#BoostHub) | Param | Type | Description | | --- | --- | --- | +| button | string | | | state | number | A number representing one of the button state consts. | @@ -196,13 +200,13 @@ Emits when a rotation sensor is activated. **Extends**: [Hub](#Hub) * [WeDo2Hub](#WeDo2Hub) ⇐ [Hub](#Hub) - * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) - * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) - * [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed) + * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ Promise + * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ Promise + * [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed) ⇒ Promise * [.connect([callback])](#Hub+connect) * [.subscribe(port, [mode])](#Hub+subscribe) * [.unsubscribe(port)](#Hub+unsubscribe) - * ["button" (state)](#WeDo2Hub+event_button) + * ["button" (button, state)](#WeDo2Hub+event_button) * ["distance" (port, distance)](#WeDo2Hub+event_distance) * ["color" (port, color)](#WeDo2Hub+event_color) * ["tilt" (port, x, y)](#WeDo2Hub+event_tilt) @@ -210,10 +214,11 @@ Emits when a rotation sensor is activated. -### weDo2Hub.setLEDColor(color) +### weDo2Hub.setLEDColor(color) ⇒ Promise 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. | Param | Type | Description | | --- | --- | --- | @@ -221,10 +226,11 @@ Set the color of the LED on the Hub via a color value. -### weDo2Hub.setLEDRGB(red, green, blue) +### weDo2Hub.setLEDRGB(red, green, blue) ⇒ Promise 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. | Param | Type | | --- | --- | @@ -234,10 +240,11 @@ Set the color of the LED on the Hub via RGB values. -### weDo2Hub.setMotorSpeed(port, speed) +### weDo2Hub.setMotorSpeed(port, speed) ⇒ Promise Set the motor speed on a given port. **Kind**: instance method of [WeDo2Hub](#WeDo2Hub) +**Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | @@ -281,13 +288,14 @@ Unsubscribe to sensor notifications on a given port. -### "button" (state) +### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [WeDo2Hub](#WeDo2Hub) | Param | Type | Description | | --- | --- | --- | +| button | string | | | state | number | A number representing one of the button state consts. | diff --git a/README.md b/README.md index 0a22b7b..8662949 100644 --- a/README.md +++ b/README.md @@ -85,13 +85,13 @@ Emits when a LPF2 Hub device is found. **Extends**: [Hub](#Hub) * [BoostHub](#BoostHub) ⇐ [Hub](#Hub) - * [.setLEDColor(color)](#BoostHub+setLEDColor) - * [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed) - * [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle) + * [.setLEDColor(color)](#BoostHub+setLEDColor) ⇒ Promise + * [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed) ⇒ Promise + * [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle) ⇒ Promise * [.connect([callback])](#Hub+connect) * [.subscribe(port, [mode])](#Hub+subscribe) * [.unsubscribe(port)](#Hub+unsubscribe) - * ["button" (state)](#BoostHub+event_button) + * ["button" (button, state)](#BoostHub+event_button) * ["distance" (port, distance)](#BoostHub+event_distance) * ["color" (port, color)](#BoostHub+event_color) * ["tilt" (port, x, y)](#BoostHub+event_tilt) @@ -99,10 +99,11 @@ Emits when a LPF2 Hub device is found. -### boostHub.setLEDColor(color) +### boostHub.setLEDColor(color) ⇒ Promise 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. | Param | Type | Description | | --- | --- | --- | @@ -110,10 +111,11 @@ Set the color of the LED on the Hub via a color value. -### boostHub.setMotorSpeed(port, speed, [time]) +### boostHub.setMotorSpeed(port, speed, [time]) ⇒ Promise 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. | Param | Type | Description | | --- | --- | --- | @@ -123,10 +125,11 @@ Set the motor speed on a given port. -### boostHub.setMotorAngle(port, angle, [speed]) +### boostHub.setMotorAngle(port, angle, [speed]) ⇒ Promise 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). | Param | Type | Default | Description | | --- | --- | --- | --- | @@ -171,13 +174,14 @@ Unsubscribe to sensor notifications on a given port. -### "button" (state) +### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [BoostHub](#BoostHub) | Param | Type | Description | | --- | --- | --- | +| button | string | | | state | number | A number representing one of the button state consts. | @@ -236,13 +240,13 @@ Emits when a rotation sensor is activated. **Extends**: [Hub](#Hub) * [WeDo2Hub](#WeDo2Hub) ⇐ [Hub](#Hub) - * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) - * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) - * [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed) + * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ Promise + * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ Promise + * [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed) ⇒ Promise * [.connect([callback])](#Hub+connect) * [.subscribe(port, [mode])](#Hub+subscribe) * [.unsubscribe(port)](#Hub+unsubscribe) - * ["button" (state)](#WeDo2Hub+event_button) + * ["button" (button, state)](#WeDo2Hub+event_button) * ["distance" (port, distance)](#WeDo2Hub+event_distance) * ["color" (port, color)](#WeDo2Hub+event_color) * ["tilt" (port, x, y)](#WeDo2Hub+event_tilt) @@ -250,10 +254,11 @@ Emits when a rotation sensor is activated. -### weDo2Hub.setLEDColor(color) +### weDo2Hub.setLEDColor(color) ⇒ Promise 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. | Param | Type | Description | | --- | --- | --- | @@ -261,10 +266,11 @@ Set the color of the LED on the Hub via a color value. -### weDo2Hub.setLEDRGB(red, green, blue) +### weDo2Hub.setLEDRGB(red, green, blue) ⇒ Promise 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. | Param | Type | | --- | --- | @@ -274,10 +280,11 @@ Set the color of the LED on the Hub via RGB values. -### weDo2Hub.setMotorSpeed(port, speed) +### weDo2Hub.setMotorSpeed(port, speed) ⇒ Promise Set the motor speed on a given port. **Kind**: instance method of [WeDo2Hub](#WeDo2Hub) +**Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | @@ -321,13 +328,14 @@ Unsubscribe to sensor notifications on a given port. -### "button" (state) +### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [WeDo2Hub](#WeDo2Hub) | Param | Type | Description | | --- | --- | --- | +| button | string | | | state | number | A number representing one of the button state consts. | diff --git a/package.json b/package.json index f0417d1..17b98ab 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "tslint -c tslint.json \"*.ts\" && tsc", "docs": "jsdoc2md dist/lpf2.js dist/boosthub.js dist/wedo2hub.js dist/hub.js dist/consts.js > DOCS.md", "readme": "cat ABOUT.md DOCS.md > README.md", + "all": "npm run build && npm run docs && npm run readme", "prepublishOnly": "tsc" }, "author": "Nathan Kunicki ",