Separate init functions from event handling setup

Adds a new section for all functions that add event handlers.
This commit is contained in:
Samuel Mannehed 2017-01-23 14:54:31 +01:00
parent 3fdc69ceda
commit 59387b34ea
1 changed files with 29 additions and 23 deletions

View File

@ -237,6 +237,34 @@ var UI;
UI.initSetting('reconnect_delay', 5000);
},
initRFB: function() {
try {
UI.rfb = new RFB({'target': document.getElementById('noVNC_canvas'),
'onNotification': UI.notification,
'onUpdateState': UI.updateState,
'onDisconnected': UI.disconnectFinished,
'onPasswordRequired': UI.passwordRequired,
'onXvpInit': UI.updateXvpButton,
'onClipboard': UI.clipboardReceive,
'onBell': UI.bell,
'onFBUComplete': UI.initialResize,
'onFBResize': UI.updateSessionSize,
'onDesktopName': UI.updateDesktopName});
return true;
} catch (exc) {
var msg = "Unable to create RFB client -- " + exc;
Util.Error(msg);
UI.showStatus(msg, 'error');
return false;
}
},
/* ------^-------
* /INIT
* ==============
* EVENT HANDLERS
* ------v------*/
addResizeHandlers: function() {
window.addEventListener('resize', UI.applyResizeMode);
window.addEventListener('resize', UI.updateViewClip);
@ -416,30 +444,8 @@ var UI;
window.addEventListener('msfullscreenchange', UI.updateFullscreenButton);
},
initRFB: function() {
try {
UI.rfb = new RFB({'target': document.getElementById('noVNC_canvas'),
'onNotification': UI.notification,
'onUpdateState': UI.updateState,
'onDisconnected': UI.disconnectFinished,
'onPasswordRequired': UI.passwordRequired,
'onXvpInit': UI.updateXvpButton,
'onClipboard': UI.clipboardReceive,
'onBell': UI.bell,
'onFBUComplete': UI.initialResize,
'onFBResize': UI.updateSessionSize,
'onDesktopName': UI.updateDesktopName});
return true;
} catch (exc) {
var msg = "Unable to create RFB client -- " + exc;
Util.Error(msg);
UI.showStatus(msg, 'error');
return false;
}
},
/* ------^-------
* /INIT
* /EVENT HANDLERS
* ==============
* VISUAL
* ------v------*/