Avoid use of 'let' and 'const'

They are not supported on older browsers, e.g. iOS 9.
This commit is contained in:
Pierre Ossman 2017-06-02 15:11:05 +02:00
parent 493ad1a24b
commit 858ea4a774
12 changed files with 22 additions and 22 deletions

View File

@ -9,7 +9,7 @@
// Fallback for all uncought errors
function handleError (event, err) {
try {
const msg = document.getElementById('noVNC_fallback_errormsg');
var msg = document.getElementById('noVNC_fallback_errormsg');
// Only show the initial error
if (msg.hasChildNodes()) {

View File

@ -21,7 +21,7 @@ import RFB from "../core/rfb.js";
import Display from "../core/display.js";
import * as WebUtil from "./webutil.js";
const UI = {
var UI = {
connected: false,
desktopName: "",

View File

@ -206,7 +206,7 @@ export function injectParamIfMissing (path, param, value) {
// will receive either an event or an error on failure.
export function fetchJSON(path, resolve, reject) {
// NB: IE11 doesn't support JSON as a responseType
const req = new XMLHttpRequest();
var req = new XMLHttpRequest();
req.open('GET', path);
req.onload = function () {

View File

@ -19,7 +19,7 @@ import KeyTable from "./keysym.js";
// Keyboard event handler
//
const Keyboard = function (defaults) {
function Keyboard(defaults) {
this._keyDownList = {}; // List of depressed keys
// (even if they are happy)
this._pendingKey = null; // Key waiting for keypress
@ -276,7 +276,7 @@ make_properties(Keyboard, [
['onKeyEvent', 'rw', 'func'] // Handler for key press/release
]);
const Mouse = function (defaults) {
function Mouse(defaults) {
this._doubleClickTimer = null;
this._lastTouchPos = null;

View File

@ -24,7 +24,7 @@ export function stopEvent (e) {
// Emulate Element.setCapture() when not supported
var _captureRecursion = false;
var _captureElem = null;
const _captureProxy = function (e) {
function _captureProxy(e) {
// Recursion protection as we'll see our own event
if (_captureRecursion) return;
@ -50,11 +50,11 @@ const _captureProxy = function (e) {
};
// Follow cursor style of target element
const _captureElemChanged = function() {
function _captureElemChanged() {
var captureElem = document.getElementById("noVNC_mouse_capture_elem");
captureElem.style.cursor = window.getComputedStyle(_captureElem).cursor;
};
const _captureObserver = new MutationObserver(_captureElemChanged);
var _captureObserver = new MutationObserver(_captureElemChanged);
var _captureIndex = 0;

View File

@ -153,7 +153,7 @@ Localizer.prototype = {
}
for (var i = 0;i < elem.childNodes.length;i++) {
let node = elem.childNodes[i];
var node = elem.childNodes[i];
if (node.nodeType === node.ELEMENT_NODE) {
process(node, enabled);
} else if (node.nodeType === node.TEXT_NODE && enabled) {
@ -166,5 +166,5 @@ Localizer.prototype = {
},
}
export const l10n = new Localizer();
export var l10n = new Localizer();
export default l10n.get.bind(l10n);

View File

@ -1304,8 +1304,8 @@ var WorkerPool = function (script, size) {
this._jobs = 0;
this.onmessage = undefined;
this._stopTimeout = undefined;
for (let i = 0; i < size; i++) {
let wrkr = new Worker(script);
for (var i = 0; i < size; i++) {
var wrkr = new Worker(script);
wrkr._count = 0;
wrkr._ind = i;
wrkr.onmessage = this._onmessage.bind(this, wrkr);
@ -1321,7 +1321,7 @@ WorkerPool.prototype = {
clearTimeout(this._stopTimeout);
this._stopTimeout = undefined;
}
let wrkr = this._workers[this._ind % this._size];
var wrkr = this._workers[this._ind % this._size];
wrkr._count++;
this._jobs++;
wrkr.postMessage(msg);

File diff suppressed because one or more lines are too long

View File

@ -144,8 +144,8 @@ var WorkerPool = function (script, size) {
this._jobs = 0;
this.onmessage = undefined;
this._stopTimeout = undefined;
for (let i = 0; i < size; i++) {
let wrkr = new Worker(script);
for (var i = 0; i < size; i++) {
var wrkr = new Worker(script);
wrkr._count = 0;
wrkr._ind = i;
wrkr.onmessage = this._onmessage.bind(this, wrkr);
@ -161,7 +161,7 @@ WorkerPool.prototype = {
clearTimeout(this._stopTimeout);
this._stopTimeout = undefined;
}
let wrkr = this._workers[this._ind % this._size];
var wrkr = this._workers[this._ind % this._size];
wrkr._count++;
this._jobs++;
wrkr.postMessage(msg);

View File

@ -40,6 +40,6 @@ export function flattenChunks (chunks) {
return result;
}
export const Buf8 = Uint8Array;
export const Buf16 = Uint16Array;
export const Buf32 = Int32Array;
export var Buf8 = Uint8Array;
export var Buf16 = Uint16Array;
export var Buf32 = Int32Array;

View File

@ -1834,7 +1834,7 @@ function deflateSetDictionary(strm, dictionary) {
export { deflateInit, deflateInit2, deflateReset, deflateResetKeep, deflateSetHeader, deflate, deflateEnd, deflateSetDictionary };
export const deflateInfo = 'pako deflate (from Nodeca project)';
export var deflateInfo = 'pako deflate (from Nodeca project)';
/* Not implemented
exports.deflateBound = deflateBound;

View File

@ -1514,7 +1514,7 @@ function inflateSetDictionary(strm, dictionary) {
}
export { inflateReset, inflateReset2, inflateResetKeep, inflateInit, inflateInit2, inflate, inflateEnd, inflateGetHeader, inflateSetDictionary };
export const inflateInfo = 'pako inflate (from Nodeca project)';
export var inflateInfo = 'pako inflate (from Nodeca project)';
/* Not implemented
exports.inflateCopy = inflateCopy;