From: Jérôme Benoit Date: Sun, 11 Apr 2021 17:19:13 +0000 (+0200) Subject: Improve a bit JSDoc. X-Git-Tag: v1.0.1-0~57 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e71cccf31ce6e57fc1b0a8aeb97ef3d218f22b28;p=e-mobility-charging-stations-simulator.git Improve a bit JSDoc. Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 290316cc..5615eb77 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -72,8 +72,8 @@ export default abstract class OCPPRequestService { /** * Function that will receive the request's response * - * @param payload - * @param requestPayload + * @param {Record | string} payload + * @param {Record} requestPayload */ async function responseCallback(payload: Record | string, requestPayload: Record): Promise { if (self.chargingStation.getEnableStatistics()) { @@ -87,7 +87,7 @@ export default abstract class OCPPRequestService { /** * Function that will receive the request's rejection * - * @param error + * @param {OCPPError} error */ function rejectCallback(error: OCPPError): void { if (self.chargingStation.getEnableStatistics()) { diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index e4bc6a7b..25ac7634 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -183,8 +183,8 @@ export default class Utils { static insertAt = (str: string, subStr: string, pos: number): string => `${str.slice(0, pos)}${subStr}${str.slice(pos)}`; /** - * @param {number} [retryNumber=0] - * @returns {number} - delay in milliseconds + * @param {number} [retryNumber=0] + * @returns {number} delay in milliseconds */ static exponentialDelay(retryNumber = 0): number { const delay = Math.pow(2, retryNumber) * 100; @@ -192,6 +192,12 @@ export default class Utils { return delay + randomSum; } + /** + * Convert websocket error code to human readable string message + * + * @param {number} code websocket error code + * @returns {string} human readable string message + */ static getWebSocketCloseEventStatusString(code: number): string { if (code >= 0 && code <= 999) { return '(Unused)'; diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 6a8a0a0f..9f16af73 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -6,7 +6,7 @@ export default abstract class WorkerAbstract { public abstract maxElementsPerWorker: number; /** - * Create a new `Worker` implementation. + * `WorkerAbstract` constructor. * * @param {string} workerScript */ diff --git a/src/worker/WorkerDynamicPool.ts b/src/worker/WorkerDynamicPool.ts index eb570887..a9aa56f0 100644 --- a/src/worker/WorkerDynamicPool.ts +++ b/src/worker/WorkerDynamicPool.ts @@ -13,8 +13,8 @@ export default class WorkerDynamicPool extends WorkerAbstract { * Create a new `WorkerDynamicPool`. * * @param {string} workerScript - * @param min - * @param max + * @param {number} min + * @param {number} max */ constructor(workerScript: string, min: number, max: number,) { super(workerScript); diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index bda3018b..bf8b7021 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -69,7 +69,6 @@ export default class WorkerSet extends WorkerAbstract { /** * - * @returns {Promise} * @private */ private startWorker(): void { diff --git a/src/worker/WorkerStaticPool.ts b/src/worker/WorkerStaticPool.ts index 97664dba..64217629 100644 --- a/src/worker/WorkerStaticPool.ts +++ b/src/worker/WorkerStaticPool.ts @@ -13,7 +13,7 @@ export default class WorkerStaticPool extends WorkerAbstract { * Create a new `WorkerStaticPool`. * * @param {string} workerScript - * @param numberOfThreads + * @param {number} numberOfThreads */ constructor(workerScript: string, numberOfThreads: number) { super(workerScript);