Use let and const instead of var in vnc_lite

The rest of noVNC has been converted already. This allows us to remove
the extra scope that was created for the VNC connection.
This commit is contained in:
Samuel Mannehed 2018-08-16 11:34:17 +02:00
parent 6517c498b9
commit 25551b6b40
1 changed files with 32 additions and 34 deletions

View File

@ -72,7 +72,7 @@
<script>
window.addEventListener("load", function() {
if (window._noVNC_has_module_support) return;
var loader = document.createElement("script");
const loader = document.createElement("script");
loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
document.head.appendChild(loader);
});
@ -83,8 +83,8 @@
// RFB holds the API to connect and communicate with a VNC server
import RFB from './core/rfb.js';
var rfb;
var desktopName;
let rfb;
let desktopName;
// When this function is called we have received
// a desktop name from the server
@ -96,7 +96,7 @@
// credentials to authenticate
function credentials(e) {
// Let's create a password input
var form = document.createElement('form');
const form = document.createElement('form');
form.innerHTML = '<label></label>';
form.innerHTML += '<input type=password size=10 id="password_input">';
form.onsubmit = setPassword;
@ -168,20 +168,19 @@
// Read parameters specified in the URL query string
// By default, use the host and port of server that served this file
var host = readQueryVariable('host', window.location.hostname);
var port = readQueryVariable('port', window.location.port);
var password = readQueryVariable('password', '');
var path = readQueryVariable('path', 'websockify');
const host = readQueryVariable('host', window.location.hostname);
let port = readQueryVariable('port', window.location.port);
const password = readQueryVariable('password', '');
const path = readQueryVariable('path', 'websockify');
// | | | | | |
// | | | Connect | | |
// v v v v v v
(function() {
status("Connecting");
// Build the websocket URL used to connect
var url;
let url;
if (window.location.protocol === "https:") {
url = 'wss';
} else {
@ -206,7 +205,6 @@
// Set parameters that can be changed on an active connection
rfb.viewOnly = readQueryVariable('view_only', false);
rfb.scaleViewport = readQueryVariable('scale', false);
})();
</script>
</head>