File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ 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
+ import cbstate from './modules/state' ;
19
+ import task from './modules/task' ;
19
20
import WebSocket from 'ws' ;
20
21
22
+
21
23
/**
22
24
* @class Codebolt
23
25
* @description This class provides a unified interface to interact with various modules.
@@ -89,6 +91,7 @@ class Codebolt {
89
91
project = cbproject ;
90
92
dbmemory = dbmemory ;
91
93
cbstate = cbstate ;
94
+ taskplaner = task
92
95
}
93
96
94
97
// export default new Codebolt();
Original file line number Diff line number Diff line change 1
1
import cbws from './websocket' ;
2
2
3
-
3
+ /**
4
+ * Retrieves the application state asynchronously.
5
+ * @returns {Promise<any> } A promise that resolves with the application state.
6
+ */
4
7
const cbstate = {
5
8
getApplicationState : async ( ) : Promise < any > => {
6
9
return new Promise ( ( resolve , reject ) => {
@@ -19,4 +22,3 @@ const cbstate = {
19
22
} ;
20
23
21
24
export default cbstate ;
22
-
Original file line number Diff line number Diff line change
1
+ import cbws from './websocket' ;
2
+
3
+ /**
4
+ * Fetches the list of tasks asynchronously.
5
+ * @returns {Promise<any> } A promise that resolves with the list of tasks.
6
+ */
7
+ const taskplaner = {
8
+ getTasks : async ( ) : Promise < any > => {
9
+ return new Promise ( ( resolve , reject ) => {
10
+ cbws . getWebsocket . send ( JSON . stringify ( {
11
+ "type" : "getTasks" ,
12
+
13
+ } ) ) ;
14
+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
15
+ const response = JSON . parse ( data ) ;
16
+ if ( response . type === "getTasksResponse" ) {
17
+ resolve ( response ) ; // Resolve the Promise with the task data
18
+ }
19
+ } ) ;
20
+ } ) ;
21
+ }
22
+ } ;
23
+
24
+ export default taskplaner ;
You can’t perform that action at this time.
0 commit comments