Use the classic `function foo() { ... }` for top level functions or functions that depend on the scope

This commit is contained in:
Juanjo Diaz 2018-07-09 22:48:22 +02:00
parent 651c23ece3
commit 885363a373
3 changed files with 10 additions and 11 deletions

View File

@ -89,11 +89,11 @@ for (let i = 0; i < opt.argv.length; i++) {
const dom = new jsdom.JSDOM(file, { includeNodeLocations: true }); const dom = new jsdom.JSDOM(file, { includeNodeLocations: true });
const body = dom.window.document.body; const body = dom.window.document.body;
const locator = (elem) => { function locator(elem) {
const offset = dom.nodeLocation(elem).startOffset; const offset = dom.nodeLocation(elem).startOffset;
const line = file.slice(0, offset).split("\n").length; const line = file.slice(0, offset).split("\n").length;
return fn + ":" + line; return fn + ":" + line;
}; }
process(body, locator, true); process(body, locator, true);
} }

View File

@ -24,7 +24,7 @@ if (window.setImmediate === undefined) {
_immediateFuncs[id]; _immediateFuncs[id];
}; };
const _onMessage = (event) => { window.addEventListener("message", (event) => {
if ((typeof event.data !== "string") || if ((typeof event.data !== "string") ||
(event.data.indexOf("noVNC immediate trigger:") !== 0)) { (event.data.indexOf("noVNC immediate trigger:") !== 0)) {
return; return;
@ -40,8 +40,7 @@ if (window.setImmediate === undefined) {
delete _immediateFuncs[index]; delete _immediateFuncs[index];
callback(); callback();
}; });
window.addEventListener("message", _onMessage);
} }
export default class RecordingPlayer { export default class RecordingPlayer {

View File

@ -23,24 +23,24 @@ import sinon from '../vendor/sinon.js';
window.UIEvent = UIEvent; window.UIEvent = UIEvent;
})(); })();
const push8 = (arr, num) => { function push8(arr, num) {
"use strict"; "use strict";
arr.push(num & 0xFF); arr.push(num & 0xFF);
}; }
const push16 = (arr, num) => { function push16(arr, num) {
"use strict"; "use strict";
arr.push((num >> 8) & 0xFF, arr.push((num >> 8) & 0xFF,
num & 0xFF); num & 0xFF);
}; }
const push32 = (arr, num) => { function push32(arr, num) {
"use strict"; "use strict";
arr.push((num >> 24) & 0xFF, arr.push((num >> 24) & 0xFF,
(num >> 16) & 0xFF, (num >> 16) & 0xFF,
(num >> 8) & 0xFF, (num >> 8) & 0xFF,
num & 0xFF); num & 0xFF);
}; }
describe('Remote Frame Buffer Protocol Client', function() { describe('Remote Frame Buffer Protocol Client', function() {
let clock; let clock;