You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sites/cheerpx/src/content/docs/12-reference/CheerpX.Linux/04-setCustomConsole.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,23 @@ description: Configure custom console behavior for handling keyboard input and o
7
7
namespaceCheerpX {
8
8
classLinux {
9
9
setCustomConsole(
10
-
writeFunc: (buf:Buffer) =>void,
10
+
writeFunc: (buf:Uint8Array, vt:number) =>void,
11
11
cols:number,
12
12
rows:number
13
-
):(keyCode:number) =>void;
13
+
):client.EventListener;
14
14
}
15
15
}
16
16
```
17
17
18
18
## Parameters
19
19
20
-
-**writeFunc (`(buf: Buffer) => void`)** - Function to handle the output sent to the console.
20
+
-**writeFunc (`(buf: Uint8Array, vt: number) => void`)** - Function to handle the output sent to the console.
21
21
-**cols (`number`)** - Number of columns for the console.
22
22
-**rows (`number`)** - Number of rows for the console.
23
23
24
24
## Returns
25
25
26
-
`setCustomConsole` returns a function of type `(keyCode: number) => void`. This function should be called to simulate user input by sending key codes to the console.
26
+
`setCustomConsole` returns an event listener function of type `client.EventListener`. This function simulates user input by sending key codes to the console when triggered.
Registers a callback function for a specific event type.
15
15
16
16
**Parameters**
17
17
18
18
-**eventName (`string`)** - A string specifying the event type. Can be `"cpuActivity"`, `"diskActivity"`, or `"diskLatency"`.
19
-
-**callback (`(state: string | number) => void`)** - A function that will be called when the event occurs. It receives a parameter which varies based on the event type:
20
-
- For `"cpuActivity"` and `"diskActivity"`: `state` can be either "ready" (idle, no activity at this time) or "wait" (active, currently in use).
19
+
-**callback (`EventListener`)** - A function that will be called when the event occurs. It receives a parameter, `state`, which varies based on the event type:
20
+
- For `"cpuActivity"` and `"diskActivity"`: `state` can be either `"ready"` (idle, no activity at this time) or `"wait"` (active, currently in use).
21
21
- For `"diskLatency"`: `state` is a number representing the time in milliseconds between requesting and receiving the last disk block from the backend.
Unregisters a previously registered callback function for a specific event type.
30
30
31
31
**Parameters**
32
32
33
33
-**eventName (`string`)** - A string specifying the event type. See the `registerCallback` reference above for the supported event types.
34
-
-**callback (`(state: string | number) => void`)** - The function to be unregistered.
34
+
-**callback (`EventListener`)** - The callback function to unregister, which must be the same function that was previously registered with `registerCallback`.
0 commit comments