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';
1515import cbproject from './modules/project' ;
1616import git from './modules/git' ;
1717import dbmemory from './modules/dbmemory' ;
18- import cbstate from './modules/state'
18+ import cbstate from './modules/state' ;
19+ import task from './modules/task' ;
1920import WebSocket from 'ws' ;
2021
22+
2123/**
2224 * @class Codebolt
2325 * @description This class provides a unified interface to interact with various modules.
@@ -89,6 +91,7 @@ class Codebolt {
8991 project = cbproject ;
9092 dbmemory = dbmemory ;
9193 cbstate = cbstate ;
94+ taskplaner = task
9295}
9396
9497// export default new Codebolt();
Original file line number Diff line number Diff line change 11import cbws from './websocket' ;
22
3-
3+ /**
4+ * Retrieves the application state asynchronously.
5+ * @returns {Promise<any> } A promise that resolves with the application state.
6+ */
47const cbstate = {
58 getApplicationState : async ( ) : Promise < any > => {
69 return new Promise ( ( resolve , reject ) => {
@@ -19,4 +22,3 @@ const cbstate = {
1922} ;
2023
2124export 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