@@ -209,17 +209,21 @@ const preExecutionCode = "// About to terminate connection";
209209const postExecutionCode = " // Connection terminated" ;
210210const indent = 2 ;
211211
212- return (
213- < CloseConnection
214- language= {language}
215- framework= {framework}
216- methodName= {methodName}
217- methodParams= {methodParams}
218- preExecutionCode= {preExecutionCode}
219- postExecutionCode= {postExecutionCode}
220- indent= {indent}
221- / >
222- );
212+ function renderCloseConnection () {
213+ return (
214+ < CloseConnection
215+ language= {language}
216+ framework= {framework}
217+ methodName= {methodName}
218+ methodParams= {methodParams}
219+ preExecutionCode= {preExecutionCode}
220+ postExecutionCode= {postExecutionCode}
221+ indent= {indent}
222+ / >
223+ );
224+ }
225+
226+ renderCloseConnection ();
223227```
224228
225229
@@ -251,12 +255,16 @@ Renders a WebSocket connection method for the specified programming language.
251255const language = " python" ;
252256const title = " HoppscotchEchoWebSocketClient" ;
253257
254- return (
255- < Connect
256- language= {language}
257- title= {title}
258- / >
259- )
258+ function renderConnect () {
259+ return (
260+ < Connect
261+ language= {language}
262+ title= {title}
263+ / >
264+ )
265+ }
266+
267+ renderConnect ();
260268```
261269
262270
@@ -292,14 +300,17 @@ const framework = "quarkus";
292300const role = " client" ;
293301const additionalDependencies = [" import java.util.concurrent.CompletableFuture;" , " import java.time.Duration;" ];
294302
295- return (
296- < DependencyProvider
297- language= {language}
298- framework= {framework}
299- role= {role}
300- additionalDependencies= {additionalDependencies}
301- / >
302- )
303+ function renderDependencyProvider () {
304+ return (
305+ < DependencyProvider
306+ language= {language}
307+ framework= {framework}
308+ role= {role}
309+ additionalDependencies= {additionalDependencies}
310+ / >
311+ )
312+ }
313+ renderDependencyProvider ();
303314```
304315
305316
@@ -395,16 +406,21 @@ const customMethodConfig = {
395406 methodLogic: " if (cb) cb(message);"
396407 }
397408};
398- return (
399- < HandleMessage
400- language= {language}
401- methodName= {methodName}
402- methodParams= {methodParams}
403- preExecutionCode= {preExecutionCode}
404- postExecutionCode= {postExecutionCode}
405- customMethodConfig= {customMethodConfig}
406- / >
407- )
409+
410+ function renderHandleMessage () {
411+ return (
412+ < HandleMessage
413+ language= {language}
414+ methodName= {methodName}
415+ methodParams= {methodParams}
416+ preExecutionCode= {preExecutionCode}
417+ postExecutionCode= {postExecutionCode}
418+ customMethodConfig= {customMethodConfig}
419+ / >
420+ )
421+ }
422+
423+ renderHandleMessage ();
408424```
409425
410426
@@ -454,20 +470,24 @@ const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 };
454470const methodConfig = {" java" : {methodDocs : methodDocs, methodLogic: methodLogic }};
455471const framework = " quarkus" ;
456472
457- return (
458- < MethodGenerator
459- language= {language}
460- methodName= {methodName}
461- methodParams= {methodParams}
462- methodDocs= {methodDocs}
463- methodLogic= {methodLogic}
464- preExecutionCode= {preExecutionCode}
465- postExecutionCode= {postExecutionCode}
466- customMethodConfig= {customMethodConfig}
467- methodConfig= {methodConfig}
468- framework= {framework}
469- / >
470- )
473+ function renderMethodGenerator () {
474+ return (
475+ < MethodGenerator
476+ language= {language}
477+ methodName= {methodName}
478+ methodParams= {methodParams}
479+ methodDocs= {methodDocs}
480+ methodLogic= {methodLogic}
481+ preExecutionCode= {preExecutionCode}
482+ postExecutionCode= {postExecutionCode}
483+ customMethodConfig= {customMethodConfig}
484+ methodConfig= {methodConfig}
485+ framework= {framework}
486+ / >
487+ )
488+ }
489+
490+ renderMethodGenerator ();
471491```
472492
473493
@@ -555,13 +575,17 @@ const language = "java";
555575const framework = " quarkus" ;
556576const title = " HoppscotchEchoWebSocketClient" ;
557577
558- return (
559- < OnClose
560- language= {language}
561- framework= {framework}
562- title= {title}
563- / >
564- )
578+ function renderOnClose () {
579+ return (
580+ < OnClose
581+ language= {language}
582+ framework= {framework}
583+ title= {title}
584+ / >
585+ )
586+ }
587+
588+ renderOnClose ();
565589```
566590
567591
@@ -590,9 +614,14 @@ Renders a WebSocket onError event handler for the specified programming language
590614
591615``` js
592616const language = " javascript" ;
593- return (
594- < OnError language= {language} / >
595- )
617+
618+ function renderOnError () {
619+ return (
620+ < OnError language= {language} / >
621+ )
622+ }
623+
624+ renderOnError ();
596625```
597626
598627
@@ -621,9 +650,14 @@ Renders a WebSocket onMessage event handler for the specified programming langua
621650
622651``` js
623652const language = " javascript" ;
624- return (
625- < OnMessage language= {language} / >
626- )
653+
654+ function renderOnMessage () {
655+ return (
656+ < OnMessage language= {language} / >
657+ )
658+ }
659+
660+ renderOnMessage ();
627661```
628662
629663
@@ -657,13 +691,17 @@ const language = "java";
657691const framework = " quarkus" ;
658692const title = " HoppscotchEchoWebSocketClient" ;
659693
660- return (
661- < OnOpen
662- language= {language}
663- framework= {framework}
664- title= {title}
665- / >
666- )
694+ function renderOnOpen () {
695+ return (
696+ < OnOpen
697+ language= {language}
698+ framework= {framework}
699+ title= {title}
700+ / >
701+ )
702+ }
703+
704+ renderOnOpen ();
667705```
668706
669707
@@ -796,9 +834,14 @@ Renders a list of core WebSocket client methods for a given target language.
796834
797835``` js
798836const language = " javascript" ;
799- return (
800- < CoreMethods language= {language} / >
801- )
837+
838+ function renderCoreMethods () {
839+ return (
840+ < CoreMethods language= {language} / >
841+ )
842+ }
843+
844+ renderCoreMethods ();
802845```
803846
804847
@@ -827,9 +870,14 @@ Renders the Installation Command for a given language.
827870
828871``` js
829872const language = " javascript" ;
830- return (
831- < Installation language= {language} / >
832- )
873+
874+ function renderInstallation () {
875+ return (
876+ < Installation language= {language} / >
877+ )
878+ }
879+
880+ renderInstallation ()
833881```
834882
835883
@@ -1076,13 +1124,17 @@ const clientName = "MyClient";
10761124const clientFileName = " myClient.js" ;
10771125const language = " javascript" ;
10781126
1079- return (
1080- < Usage
1081- clientName= {clientName}
1082- clientFileName= {clientFileName}
1083- language= {language}
1084- / >
1085- )
1127+ function renderUsage (){
1128+ return (
1129+ < Usage
1130+ clientName= {clientName}
1131+ clientFileName= {clientFileName}
1132+ language= {language}
1133+ / >
1134+ )
1135+ }
1136+
1137+ renderUsage ();
10861138```
10871139
10881140
@@ -1122,16 +1174,20 @@ const preExecutionCode = "# Pre-register operations";
11221174const postExecutionCode = " # Post-register operations" ;
11231175const customMethodConfig = { returnType: " int" , openingTag: " {" , closingTag: " }" , indentSize: 2 };
11241176
1125- return (
1126- < RegisterErrorHandler
1127- language= {language}
1128- methodName= {methodName}
1129- methodParams= {methodParams}
1130- preExecutionCode= {preExecutionCode}
1131- postExecutionCode= {postExecutionCode}
1132- customMethodConfig= {customMethodConfig}
1133- / >
1134- )
1177+ function renderRegisterErrorHandler () {
1178+ return (
1179+ < RegisterErrorHandler
1180+ language= {language}
1181+ methodName= {methodName}
1182+ methodParams= {methodParams}
1183+ preExecutionCode= {preExecutionCode}
1184+ postExecutionCode= {postExecutionCode}
1185+ customMethodConfig= {customMethodConfig}
1186+ / >
1187+ )
1188+ }
1189+
1190+ renderRegisterErrorHandler ();
11351191```
11361192
11371193
@@ -1169,15 +1225,19 @@ const methodParams = ["self", "handler"];
11691225const preExecutionCode = " # Pre-register operations" ;
11701226const postExecutionCode = " # Post-register operations" ;
11711227
1172- return (
1173- < RegisterMessageHandler
1174- language= {language}
1175- methodName= {methodName}
1176- methodParams= {methodParams}
1177- preExecutionCode= {preExecutionCode}
1178- postExecutionCode= {postExecutionCode}
1179- / >
1180- )
1228+ function renderRegisterMessageHandler (){
1229+ return (
1230+ < RegisterMessageHandler
1231+ language= {language}
1232+ methodName= {methodName}
1233+ methodParams= {methodParams}
1234+ preExecutionCode= {preExecutionCode}
1235+ postExecutionCode= {postExecutionCode}
1236+ / >
1237+ )
1238+ }
1239+
1240+ renderRegisterMessageHandler ();
11811241```
11821242
11831243
0 commit comments