Skip to content

Commit e58e89f

Browse files
committed
feat(hooks): add doc strings for each hook
1 parent 96244f2 commit e58e89f

19 files changed

Lines changed: 125 additions & 1 deletion

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"**/.DS_Store": true,
1717
"**/*.js.map": true,
1818
"node_modules": true
19-
}
19+
},
20+
"docwriter.progress.trackFunctions": true
2021
}

src/hooks/useCrestronAnalog/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import { AnalogStateCallback, IAnalogSignal } from "../../types";
22
import { useCrestronPublishAnalog } from "../useCrestronPublishAnalog";
33
import { useCrestronSubscribeAnalog } from "../useCrestronSubscribeAnalog";
44

5+
/**
6+
* `useCrestronAnalog` is a hook that returns an object with a state and action property.
7+
* @param {string} signalName - The name of the signal you want to use.
8+
* @param {AnalogStateCallback} [callback] - An optional callback function that will be called whenever the state of the signal
9+
* changes.
10+
* @returns An array with a single IAnalogSignal object.
11+
*/
512
export function useCrestronAnalog(
613
signalName: string,
714
callback?: AnalogStateCallback,

src/hooks/useCrestronAnalogCollection/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import { getSignalCollection } from "../../utils";
88
import { useCrestronPublishAnalogCollection } from "../useCrestronPublishAnalogCollection";
99
import { useCrestronSubscribeAnalogCollection } from "../useCrestronSubscribeAnalogCollection";
1010

11+
/**
12+
* `useCrestronAnalogCollection` is a hook that returns an array of objects each with state and action properties.
13+
* @param {string[]} signalNames - An array of strings that represent the names of the signals you want
14+
* to use.
15+
* @param {AnalogStateCallback} [callback] - A optional callback function that will be called whenever the state of
16+
* the signal changes.
17+
* @returns An array of IAnalogSignal objects.
18+
*/
1119
export function useCrestronAnalogCollection(
1220
signalNames: string[],
1321
callback?: AnalogStateCallback,

src/hooks/useCrestronDigital/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import { DigitalStateCallback, IDigitalSignal } from "../../types";
22
import { useCrestronPublishDigital } from "../useCrestronPublishDigital";
33
import { useCrestronSubscribeDigital } from "../useCrestronSubscribeDigital";
44

5+
/**
6+
* `useCrestronDigital` is a hook that returns an object with a state and action property.
7+
* @param {string} signalName - The name of the signal you want to use.
8+
* @param {DigitalStateCallback} [callback] - An optional callback function that will be called whenever the state of the signal
9+
* changes.
10+
* @returns An array with a single IDigitalSignal object
11+
*/
512
export function useCrestronDigital(
613
signalName: string,
714
callback?: DigitalStateCallback,

src/hooks/useCrestronDigitalCollection/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import { getSignalCollection } from "../../utils";
88
import { useCrestronPublishDigitalCollection } from "../useCrestronPublishDigitalCollection";
99
import { useCrestronSubscribeDigitalCollection } from "../useCrestronSubscribeDigitalCollection";
1010

11+
/**
12+
* `useCrestronDigitalCollection` is a hook that returns an array of objects each with state and action properties.
13+
* @param {string[]} signalNames - An array of strings that represent the names of the signals you want
14+
* to use.
15+
* @param {DigitalStateCallback} [callback] - A optional callback function that will be called whenever the state of
16+
* the signal changes.
17+
* @returns An array of IDigitalSignal objects.
18+
*/
1119
export function useCrestronDigitalCollection(
1220
signalNames: string[],
1321
callback?: DigitalStateCallback,

src/hooks/useCrestronPublishAnalog/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { publishEvent } from "@crestron/ch5-crcomlib";
22
import CrestronCH5 from "@norgate-av/crestron-ch5-helper";
33
import { IAnalogEventAction } from "../../types";
44

5+
/**
6+
* `useCrestronPublishAnalog` is a hook that returns an object with a setValue function.
7+
* @param {string} signalName - The name of the signal you want to publish to.
8+
* @returns An array with a single IAnalogEventAction object.
9+
*/
510
export function useCrestronPublishAnalog(
611
signalName: string,
712
): [IAnalogEventAction] {

src/hooks/useCrestronPublishAnalogCollection/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import { publishEvent } from "@crestron/ch5-crcomlib";
22
import CrestronCH5 from "@norgate-av/crestron-ch5-helper";
33
import { IAnalogEventAction } from "../../types";
44

5+
/**
6+
* `useCrestronPublishAnalogCollection` is a hook that returns an array of objects each with a setValue function.
7+
* @param {string[]} signalNames - An array of strings that represent the names of the signals you want
8+
* to publish to.
9+
* @returns An array of IAnalogEventAction objects.
10+
*/
511
export function useCrestronPublishAnalogCollection(
612
signalNames: string[],
713
): IAnalogEventAction[] {

src/hooks/useCrestronPublishDigital/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { publishEvent } from "@crestron/ch5-crcomlib";
22
import CrestronCH5 from "@norgate-av/crestron-ch5-helper";
33
import { IDigitalEventAction } from "../../types";
44

5+
/**
6+
* `useCrestronPublishDigital` is a hook that returns an object with setValue, push, release and click functions.
7+
* @param {string} signalName - The name of the signal you want to publish to.
8+
* @returns An array with a single IDigitalEventAction object.
9+
*/
510
export function useCrestronPublishDigital(
611
signalName: string,
712
): [IDigitalEventAction] {

src/hooks/useCrestronPublishDigitalCollection/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import { publishEvent } from "@crestron/ch5-crcomlib";
22
import CrestronCH5 from "@norgate-av/crestron-ch5-helper";
33
import { IDigitalEventAction } from "../../types";
44

5+
/**
6+
* `useCrestronPublishDigitalCollection` is a hook that returns an array of objects each with setValue, push, release and click functions.
7+
* @param {string[]} signalNames - An array of strings that represent the names of the signals you want
8+
* to publish to.
9+
* @returns An array of IDigitalEventAction objects.
10+
*/
511
export function useCrestronPublishDigitalCollection(
612
signalNames: string[],
713
): IDigitalEventAction[] {

src/hooks/useCrestronPublishSerial/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { publishEvent } from "@crestron/ch5-crcomlib";
22
import CrestronCH5 from "@norgate-av/crestron-ch5-helper";
33
import { ISerialEventAction } from "../../types";
44

5+
/**
6+
* `useCrestronPublishSerial` is a hook that returns an object with a setValue function.
7+
* @param {string} signalName - The name of the signal you want to publish to.
8+
* @returns An array with a single ISerialEventAction object.
9+
*/
510
export function useCrestronPublishSerial(
611
signalName: string,
712
): [ISerialEventAction] {

0 commit comments

Comments
 (0)