Merge init() into the constructor.
This is logical now since the external update callback can be provided when the object is created so we don't need a separate init function.
This commit is contained in:
parent
55dee43279
commit
0d1e1b7281
|
@ -117,7 +117,6 @@ load: function(target) {
|
|||
DC.rfb = RFB({'target': 'VNC_canvas',
|
||||
'updateState': DC.updateState,
|
||||
'clipboardReceive': DC.clipReceive});
|
||||
DC.rfb.init();
|
||||
|
||||
// Unfocus clipboard when over the VNC area
|
||||
$('VNC_screen').onmousemove = function () {
|
||||
|
|
|
@ -215,7 +215,7 @@ RQshiftBytes = function(len) {
|
|||
// Setup routines
|
||||
//
|
||||
|
||||
// Create the public API interface
|
||||
// Create the public API interface and initialize
|
||||
function constructor() {
|
||||
var i;
|
||||
Util.Debug(">> RFB.constructor");
|
||||
|
@ -234,6 +234,25 @@ function constructor() {
|
|||
updateState('fatal', "No working Canvas");
|
||||
}
|
||||
|
||||
init_vars();
|
||||
|
||||
/* Check web-socket-js if no builtin WebSocket support */
|
||||
if (VNC_native_ws) {
|
||||
Util.Info("Using native WebSockets");
|
||||
updateState('loaded', 'noVNC ready (using native WebSockets)');
|
||||
} else {
|
||||
Util.Warn("Using web-socket-js flash bridge");
|
||||
if ((! Util.Flash) ||
|
||||
(Util.Flash.version < 9)) {
|
||||
updateState('fatal', "WebSockets or Adobe Flash is required");
|
||||
} else if (document.location.href.substr(0, 7) === "file://") {
|
||||
updateState('fatal',
|
||||
"'file://' URL is incompatible with Adobe Flash");
|
||||
} else {
|
||||
updateState('loaded', 'noVNC ready (using Flash WebSockets emulation)');
|
||||
}
|
||||
}
|
||||
|
||||
Util.Debug("<< RFB.constructor");
|
||||
return that; // Return the public API interface
|
||||
}
|
||||
|
@ -1522,36 +1541,9 @@ clientCutText = function(text) {
|
|||
// Public API interface functions
|
||||
//
|
||||
|
||||
that.init = function () {
|
||||
|
||||
init_vars();
|
||||
|
||||
/* Check web-socket-js if no builtin WebSocket support */
|
||||
if (VNC_native_ws) {
|
||||
Util.Info("Using native WebSockets");
|
||||
updateState('loaded', 'noVNC ready (using native WebSockets)');
|
||||
} else {
|
||||
Util.Warn("Using web-socket-js flash bridge");
|
||||
if ((! Util.Flash) ||
|
||||
(Util.Flash.version < 9)) {
|
||||
updateState('fatal', "WebSockets or Adobe Flash is required");
|
||||
} else if (document.location.href.substr(0, 7) === "file://") {
|
||||
updateState('fatal',
|
||||
"'file://' URL is incompatible with Adobe Flash");
|
||||
} else {
|
||||
updateState('loaded', 'noVNC ready (using Flash WebSockets emulation)');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
that.connect = function(host, port, password) {
|
||||
//Util.Debug(">> connect");
|
||||
|
||||
// Make sure we have done init checks
|
||||
if ((rfb_state !== 'loaded') && (rfb_state !== 'fatal')) {
|
||||
that.init();
|
||||
}
|
||||
|
||||
rfb_host = host;
|
||||
rfb_port = port;
|
||||
rfb_password = (password !== undefined) ? password : "";
|
||||
|
|
Loading…
Reference in New Issue