Use standard JavaScript properties

Use normal properties with JavaScript setters and getters instead of
our homegrown stuff.

This also changes the properties to follow normal naming conventions.
This commit is contained in:
Pierre Ossman
2017-10-14 15:39:56 +02:00
parent fdff59eeb4
commit 747b462337
14 changed files with 523 additions and 756 deletions
+5 -13
View File
@@ -26,14 +26,7 @@ with transparent binary data support.
[Websock API](https://github.com/novnc/websockify/wiki/websock.js) wiki page.
## 1.2 Configuration Attributes
The Mouse, Keyboard and Display objects have a similar API for
configuration options as the RFB object. See the official API
documentation for details.
## 1.3 Callbacks
## 1.2 Callbacks
For the Mouse, Keyboard and Display objects the callback functions are
assigned to configuration attributes, just as for the RFB object. The
@@ -61,8 +54,8 @@ callback event name, and the callback function.
| name | parameters | description
| ------------- | ------------------- | ------------
| onMouseButton | (x, y, down, bmask) | Handler for mouse button click/release
| onMouseMove | (x, y) | Handler for mouse movement
| onmousebutton | (x, y, down, bmask) | Handler for mouse button click/release
| onmousemove | (x, y) | Handler for mouse movement
## 2.2 Keyboard Module
@@ -82,7 +75,7 @@ None
| name | parameters | description
| ---------- | -------------------- | ------------
| onKeyPress | (keysym, code, down) | Handler for key press/release
| onkeypress | (keysym, code, down) | Handler for key press/release
## 2.3 Display Module
@@ -91,7 +84,6 @@ None
| name | type | mode | default | description
| ----------- | ----- | ---- | ------- | ------------
| context | raw | RO | | Canvas 2D context for rendering
| logo | raw | RW | | Logo to display when cleared: {"width": width, "height": height, "type": mime-type, "data": data}
| scale | float | RW | 1.0 | Display area scale factor 0.0 - 1.0
| viewport | bool | RW | false | Use viewport clipping
@@ -131,4 +123,4 @@ None
| name | parameters | description
| ------- | ---------- | ------------
| onFlush | () | A display flush has been requested and we are now ready to resume FBU processing
| onflush | () | A display flush has been requested and we are now ready to resume FBU processing
+11 -36
View File
@@ -6,31 +6,10 @@ is instantiated once per connection.
## 1 Configuration Attributes
Each configuration option has a default value, which can be overridden
by a a configuration object passed to the constructor. Configuration
options can then be read and modified after initialization with "get_*"
and "set_*" methods respectively. For example, the following
initializes an RFB object with the 'view_only' configuration option
enabled, then confirms it was set, then disables it:
var rfb = new RFB(target, {'view_only': true});
if (rfb.get_view_only()) {
alert("View Only is set");
}
rfb.set_view_only(false);
Some attributes are read-only and cannot be changed. An exception will
be thrown if an attempt is made to set one of these attributs. The
attribute mode is one of the following:
RO - read only
RW - read write
WO - write once
| name | type | mode | default | description
| ----------------- | ----- | ---- | ---------- | ------------
| local_cursor | bool | RW | false | Request locally rendered cursor
| view_only | bool | RW | false | Disable client mouse/keyboard
| localCursor | bool | RW | false | Request locally rendered cursor
| viewOnly | bool | RW | false | Disable client mouse/keyboard
| touchButton | int | RW | 1 | Button mask (1, 2, 4) for which click to send on touch devices. 0 means ignore clicks.
| scale | float | RW | 1.0 | Display area scale factor
| viewport | bool | RW | false | Use viewport clipping
@@ -41,10 +20,6 @@ attribute mode is one of the following:
## 2 Methods
In addition to the getter and setter methods to modify configuration
attributes, the RFB object has other methods that are available in the
object instance.
| name | parameters | description
| ------------------ | ------------------------------- | ------------
| connect | (url, options) | Connect to the given URL
@@ -79,15 +54,15 @@ functions.
| name | parameters | description
| --------------------- | -------------------------- | ------------
| onUpdateState | (rfb, state, oldstate) | Connection state change (see details below)
| onNotification | (rfb, msg, level, options) | Notification for the UI (optional options)
| onDisconnected | (rfb, reason) | Disconnection finished with an optional reason. No reason specified means normal disconnect.
| onCredentialsRequired | (rfb, types) | VNC credentials are required (use sendCredentials)
| onClipboard | (rfb, text) | RFB clipboard contents received
| onBell | (rfb) | RFB Bell message received
| onFBResize | (rfb, width, height) | Frame buffer (remote desktop) size changed
| onDesktopName | (rfb, name) | VNC desktop name recieved
| onCapabilities | (rfb, capabilities) | The supported capabilities has changed
| onupdatestate | (rfb, state, oldstate) | Connection state change (see details below)
| onnotification | (rfb, msg, level, options) | Notification for the UI (optional options)
| ondisconnected | (rfb, reason) | Disconnection finished with an optional reason. No reason specified means normal disconnect.
| oncredentialsrequired | (rfb, types) | VNC credentials are required (use sendCredentials)
| onclipboard | (rfb, text) | RFB clipboard contents received
| onbell | (rfb) | RFB Bell message received
| onfbresize | (rfb, width, height) | Frame buffer (remote desktop) size changed
| ondesktopname | (rfb, name) | VNC desktop name recieved
| oncapabilities | (rfb, capabilities) | The supported capabilities has changed
__RFB onUpdateState callback details__