Skip to content

Commit 5e4b4d9

Browse files
committed
add jsdocs for @Private functions
1 parent 86578bf commit 5e4b4d9

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

packages/components/src/components/MethodGenerator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ const defaultMethodConfig = {
2020
* Resolve docs and logic for the given language + framework config.
2121
*
2222
* @private
23+
* @param {Object} params
24+
* @param {Language} params.language
25+
* @param {string} [params.methodDocs]
26+
* @param {string} [params.methodLogic]
27+
* @param {Record<Language, { methodDocs: string | undefined, methodLogic: string | undefined } | Record<string, { methodDocs: string | undefined, methodLogic: string | undefined }>>} [params.methodConfig]
28+
* @param {string} [params.framework]
29+
* @returns {{ docs: string, logic: string }}
2330
*/
2431
const resolveDocsAndLogic = ({ language, methodDocs, methodLogic, methodConfig, framework }) => {
2532
let docs = methodDocs;
@@ -45,6 +52,11 @@ const resolveDocsAndLogic = ({ language, methodDocs, methodLogic, methodConfig,
4552
* Build indented method body.
4653
*
4754
* @private
55+
* @param {string} logic
56+
* @param {string} [preExecutionCode]
57+
* @param {string} [postExecutionCode]
58+
* @param {number} indentSize
59+
* @returns {string}
4860
*/
4961
const buildIndentedLogic = (logic, preExecutionCode, postExecutionCode, indentSize) => {
5062
let completeCode = logic;

packages/components/src/components/OnClose.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ const websocketOnCloseMethod = {
4646
}
4747
}
4848
};
49+
/**
50+
* Resolves the appropriate onClose code generator for the given language and optional framework.
51+
*
52+
* @private
53+
* @param {Language} language - The target programming language.
54+
* @param {string} [framework=''] - Optional framework variant (e.g., 'quarkus' for java).
55+
* @returns {Function|undefined} The code generator function, or undefined if not found.
56+
*/
4957

5058
const resolveCloseConfig = (language, framework = '') => {
5159
const config = websocketOnCloseMethod[language];
@@ -90,6 +98,9 @@ export function OnClose({ language, framework = '', title }) {
9098

9199
if (websocketOnCloseMethod[language]) {
92100
const generateOnCloseCode = resolveCloseConfig(language, framework);
101+
if (!generateOnCloseCode) {
102+
return <Text indent={0}>{''}</Text>;
103+
}
93104
const closeResult = generateOnCloseCode(title);
94105
onCloseMethod = closeResult.onCloseMethod;
95106
indent = closeResult.indent ?? 0;

packages/components/src/components/readme/CoreMethods.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const methodConfig = {
2121
* @param {Object} props - Component props
2222
* @param {Language} props.language - Target language used to select method names.
2323
* @returns {JSX.Element} A Text component that contains a list of core client methods.
24+
* @throws {Error} When an unsupported language is provided.
2425
*
2526
* @example
2627
* const language = "javascript";

0 commit comments

Comments
 (0)