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 11{
22 "name" : " @codebolt/codeboltjs" ,
3- "version" : " 1.1.12 " ,
3+ "version" : " 1.1.13 " ,
44 "description" : " " ,
55 "keywords" : [],
66 "author" : " " ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import cboutputparsers from './modules/outputparsers';
1515import cbproject from './modules/project' ;
1616import git from './modules/git' ;
1717import dbmemory from './modules/dbmemory' ;
18+ import cbstate from './modules/state'
1819import WebSocket from 'ws' ;
1920
2021/**
@@ -87,6 +88,7 @@ class Codebolt {
8788 outputparsers = cboutputparsers ;
8889 project = cbproject ;
8990 dbmemory = dbmemory ;
91+ cbstate = cbstate ;
9092}
9193
9294// 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