Skip to content

Commit 4e204ae

Browse files
authored
Merge pull request #66 from roerohan/fix-ui-div
fix: remove outer div to give more control over component
2 parents 66221f0 + e1e134d commit 4e204ae

File tree

3 files changed

+159
-141
lines changed

3 files changed

+159
-141
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ interface Props {
154154
autoConnect?: boolean;
155155
retryDuration?: number;
156156
debug?: boolean;
157-
loadingUI?: React.ReactNode;
158157
onConnect?: EventListeners['connect'];
159158
onDisconnect?: EventListeners['disconnect'];
160159
onCredentialsRequired?: EventListeners['credentialsrequired'];
@@ -173,6 +172,27 @@ To know more about these props, check out [API.md](https://github.com/novnc/noVN
173172

174173
You can pass a `ref` to the `VncScreen` component, and access the `connect()` and `disconnect()` methods from the library. Check out [#18](https://github.com/roerohan/react-vnc/issues/18) for more details.
175174

175+
The `ref` object has the following type:
176+
```ts
177+
type VncScreenHandle = {
178+
connect: () => void;
179+
disconnect: () => void;
180+
connected: boolean;
181+
sendCredentials: (credentials: NoVncOptions["credentials"]) => void;
182+
sendKey: (keysym: number, code: string, down?: boolean) => void;
183+
sendCtrlAltDel: () => void;
184+
focus: () => void;
185+
blur: () => void;
186+
machineShutdown: () => void;
187+
machineReboot: () => void;
188+
machineReset: () => void;
189+
clipboardPaste: (text: string) => void;
190+
rfb: RFB | null;
191+
loading: boolean;
192+
eventListeners: EventListeners;
193+
};
194+
```
195+
176196
The `onConnect`, `onDisconnect`, `onCredentialsRequired`, and `onDesktopName` props are optional, and there are existing defaults set for them. For example, the default `onDisconnect` function consists of some logic to retry connecting after a certain timeout (specified by `retryDuration`). Check out the default `_onConnect` and `_onDisconnect` functions in [VncScreen.tsx](./src/lib/VncScreen.tsx) for more details.
177197

178198
The `onConnect`, `onDisconnect`, and `onCredentialsRequired` callbacks can accept a single parameter `rfb`. This parameter is the `RFB` object, which is described by [**noVNC**](https://github.com/novnc/noVNC). Learn more about the `RFB` object [here](https://github.com/novnc/noVNC/blob/master/docs/API.md#rfb).

0 commit comments

Comments
 (0)