@@ -51,15 +51,14 @@ const cbcodeutils = {
5151 } ) ;
5252 } ) ;
5353 } ,
54- matchProblem :( matcherDefinition :object , problemPatterns :[ ] , problems :[ ] ) => {
54+ performMatch :( matcherDefinition :object , problemPatterns :[ ] , problems :[ ] ) => {
5555 return new Promise ( ( resolve , reject ) => {
5656 cbws . getWebsocket . send ( JSON . stringify ( {
5757 "type" : "codeEvent" ,
58- "action" :"getJsTree " ,
58+ "action" :"performMatch " ,
5959 payload :{
6060 matcherDefinition,
6161 problemPatterns,
62- problems
6362 }
6463 } ) ) ;
6564 cbws . getWebsocket . on ( 'message' , ( data : string ) => {
@@ -69,7 +68,41 @@ const cbcodeutils = {
6968 }
7069 } ) ;
7170 } ) ;
71+ } ,
72+ getMatcherList :( ) => {
73+ return new Promise ( ( resolve , reject ) => {
74+ cbws . getWebsocket . send ( JSON . stringify ( {
75+ "type" : "codeEvent" ,
76+ "action" :"getMatcherList" ,
77+
78+ } ) ) ;
79+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
80+ const response = JSON . parse ( data ) ;
81+ if ( response . type === "getMatcherListTreeResponse" ) {
82+ resolve ( resolve ) ; // Resolve the Promise with the response data
83+ }
84+ } ) ;
85+ } ) ;
86+ } ,
87+ matchDetail :( matcher :string ) => {
88+ return new Promise ( ( resolve , reject ) => {
89+ cbws . getWebsocket . send ( JSON . stringify ( {
90+ "type" : "codeEvent" ,
91+ "action" :"getMatchDetail" ,
92+ payload :{
93+ match :matcher
94+ }
95+
96+ } ) ) ;
97+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
98+ const response = JSON . parse ( data ) ;
99+ if ( response . type === "matchDetailTreeResponse" ) {
100+ resolve ( resolve ) ; // Resolve the Promise with the response data
101+ }
102+ } ) ;
103+ } ) ;
72104 }
105+
73106} ;
74107
75108export default cbcodeutils ;
0 commit comments