From 885363a373d32416776e683a7b631d7c77484149 Mon Sep 17 00:00:00 2001 From: Juanjo Diaz Date: Mon, 9 Jul 2018 22:48:22 +0200 Subject: [PATCH] Use the classic `function foo() { ... }` for top level functions or functions that depend on the scope --- po/xgettext-html | 4 ++-- tests/playback.js | 5 ++--- tests/test.rfb.js | 12 ++++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/po/xgettext-html b/po/xgettext-html index ddb2cb29..407477bc 100755 --- a/po/xgettext-html +++ b/po/xgettext-html @@ -89,11 +89,11 @@ for (let i = 0; i < opt.argv.length; i++) { const dom = new jsdom.JSDOM(file, { includeNodeLocations: true }); const body = dom.window.document.body; - const locator = (elem) => { + function locator(elem) { const offset = dom.nodeLocation(elem).startOffset; const line = file.slice(0, offset).split("\n").length; return fn + ":" + line; - }; + } process(body, locator, true); } diff --git a/tests/playback.js b/tests/playback.js index cac9c8a6..c48a2a4e 100644 --- a/tests/playback.js +++ b/tests/playback.js @@ -24,7 +24,7 @@ if (window.setImmediate === undefined) { _immediateFuncs[id]; }; - const _onMessage = (event) => { + window.addEventListener("message", (event) => { if ((typeof event.data !== "string") || (event.data.indexOf("noVNC immediate trigger:") !== 0)) { return; @@ -40,8 +40,7 @@ if (window.setImmediate === undefined) { delete _immediateFuncs[index]; callback(); - }; - window.addEventListener("message", _onMessage); + }); } export default class RecordingPlayer { diff --git a/tests/test.rfb.js b/tests/test.rfb.js index 3d5bd288..8369a5d8 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -23,24 +23,24 @@ import sinon from '../vendor/sinon.js'; window.UIEvent = UIEvent; })(); -const push8 = (arr, num) => { +function push8(arr, num) { "use strict"; arr.push(num & 0xFF); -}; +} -const push16 = (arr, num) => { +function push16(arr, num) { "use strict"; arr.push((num >> 8) & 0xFF, num & 0xFF); -}; +} -const push32 = (arr, num) => { +function push32(arr, num) { "use strict"; arr.push((num >> 24) & 0xFF, (num >> 16) & 0xFF, (num >> 8) & 0xFF, num & 0xFF); -}; +} describe('Remote Frame Buffer Protocol Client', function() { let clock;