File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @codebolt/codeboltjs" ,
3
- "version" : " 1.1.12 " ,
3
+ "version" : " 1.1.13 " ,
4
4
"description" : " " ,
5
5
"keywords" : [],
6
6
"author" : " " ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import cboutputparsers from './modules/outputparsers';
15
15
import cbproject from './modules/project' ;
16
16
import git from './modules/git' ;
17
17
import dbmemory from './modules/dbmemory' ;
18
+ import cbstate from './modules/state'
18
19
import WebSocket from 'ws' ;
19
20
20
21
/**
@@ -87,6 +88,7 @@ class Codebolt {
87
88
outputparsers = cboutputparsers ;
88
89
project = cbproject ;
89
90
dbmemory = dbmemory ;
91
+ cbstate = cbstate ;
90
92
}
91
93
92
94
// export default new Codebolt();
Original file line number Diff line number Diff line change
1
+ import cbws from './websocket' ;
2
+
3
+
4
+ const cbstate = {
5
+ getApplicationState : async ( ) : Promise < any > => {
6
+ return new Promise ( ( resolve , reject ) => {
7
+ cbws . getWebsocket . send ( JSON . stringify ( {
8
+ "type" : "getAppState" ,
9
+
10
+ } ) ) ;
11
+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
12
+ const response = JSON . parse ( data ) ;
13
+ if ( response . type === "getAppStateResponse" ) {
14
+ resolve ( response ) ; // Resolve the Promise with the response data
15
+ }
16
+ } ) ;
17
+ } ) ;
18
+ }
19
+ } ;
20
+
21
+ export default cbstate ;
22
+
You can’t perform that action at this time.
0 commit comments