File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @codebolt/codeboltjs" ,
3- "version" : " 1.1.43 " ,
3+ "version" : " 1.1.44 " ,
44 "description" : " " ,
55 "keywords" : [],
66 "author" : " " ,
Original file line number Diff line number Diff line change @@ -129,6 +129,25 @@ const cbchat = {
129129 cbws . getWebsocket . send ( JSON . stringify ( {
130130 "type" : "processStoped"
131131 } ) ) ;
132+ } ,
133+
134+ /**
135+ * Sends a confirmation request to the server with two options: Yes or No.
136+ * @returns {Promise<string> } A promise that resolves with the server's response.
137+ */
138+ sendConfirmationRequest : ( confirmationMessage : string ) : Promise < string > => {
139+ return new Promise ( ( resolve , reject ) => {
140+ cbws . getWebsocket . send ( JSON . stringify ( {
141+ "type" : "confirmationRequest" ,
142+ "message" : confirmationMessage
143+ } ) ) ;
144+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
145+ const response = JSON . parse ( data ) ;
146+ if ( response . type === "confirmationResponse" ) {
147+ resolve ( response . answer ) ; // Resolve the Promise with the server's response
148+ }
149+ } ) ;
150+ } ) ;
132151 }
133152} ;
134153
You can’t perform that action at this time.
0 commit comments