From 59387b34ea68d529f661a490b1d7f42af9772f70 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Mon, 23 Jan 2017 14:54:31 +0100 Subject: [PATCH] Separate init functions from event handling setup Adds a new section for all functions that add event handlers. --- app/ui.js | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/app/ui.js b/app/ui.js index 4b9b27d..9f0cf16 100644 --- a/app/ui.js +++ b/app/ui.js @@ -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------*/ -- 2.39.2