Skip to content

Commit 0e06021

Browse files
committed
processStarted added
1 parent 2b034e7 commit 0e06021

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/api/Chat/processStarted.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
chat - processStarted
1+
### processStarted
22

3+
Initiates a process and sets up listening for websocket messages related to that process. It sends a `processStarted` message through the websocket and listens for a `stopProcessClicked` message. The function returns an object containing an event emitter and a method to stop the process.
34

5+
#### Syntax
46

7+
```javascript
8+
codebolt.chat.processStarted(): { event: EventEmitter, stopProcess: Function }
9+
```
10+
11+
#### Parameters
12+
13+
This function does not take any parameters.
14+
15+
#### Returns
16+
17+
Returns an object containing:
18+
- `event` (EventEmitter): An event emitter to handle custom events based on websocket messages.
19+
- `stopProcess` (Function): A function to stop the process, which also sends a `processStoped` message through the websocket.
20+
21+
#### Example
22+
23+
```javascript
24+
// Start the process and handle stop events
25+
const processControl = await codebolt.chat.processStarted();
26+
processControl.event.on('stopProcessClicked', message => {
27+
console.log("Stop process clicked:", message);
28+
processControl.stopProcess();
29+
});

0 commit comments

Comments
 (0)