diff --git a/src/scripts/taskbutton.js b/src/scripts/taskbutton.js index d2c9d6c91e..85062fdaa5 100644 --- a/src/scripts/taskbutton.js +++ b/src/scripts/taskbutton.js @@ -13,7 +13,7 @@ export default function (options) { } function updateTasks(tasks) { - var task = tasks.filter(function (t) { + const task = tasks.filter(function (t) { return t.Key == options.taskKey; })[0]; @@ -36,7 +36,7 @@ export default function (options) { } button.setAttribute('data-taskid', task.Id); - var progress = (task.CurrentProgressPercentage || 0).toFixed(1); + const progress = (task.CurrentProgressPercentage || 0).toFixed(1); if (options.progressElem) { options.progressElem.value = progress; @@ -49,7 +49,7 @@ export default function (options) { } if (options.lastResultElem) { - var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ''; + const lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ''; if (lastResult == 'Failed') { options.lastResultElem.html('(' + globalize.translate('LabelFailed') + ')'); @@ -77,9 +77,9 @@ export default function (options) { } } - var pollInterval; - var button = options.button; - var serverId = ApiClient.serverId(); + let pollInterval; + const button = options.button; + const serverId = ApiClient.serverId(); function onPollIntervalFired() { if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) { @@ -88,7 +88,7 @@ export default function (options) { } function startInterval() { - var apiClient = connectionManager.getApiClient(serverId); + const apiClient = connectionManager.getApiClient(serverId); if (pollInterval) { clearInterval(pollInterval); diff --git a/src/scripts/touchHelper.js b/src/scripts/touchHelper.js index c3e3b01a1c..c12cf79513 100644 --- a/src/scripts/touchHelper.js +++ b/src/scripts/touchHelper.js @@ -9,23 +9,23 @@ class TouchHelper { constructor(elem, options) { options = options || {}; - var touchTarget; - var touchStartX; - var touchStartY; - var lastDeltaX; - var lastDeltaY; - var thresholdYMet; - var self = this; + let touchTarget; + let touchStartX; + let touchStartY; + let lastDeltaX; + let lastDeltaY; + let thresholdYMet; + const self = this; - var swipeXThreshold = options.swipeXThreshold || 50; - var swipeYThreshold = options.swipeYThreshold || 50; - var swipeXMaxY = 30; + const swipeXThreshold = options.swipeXThreshold || 50; + const swipeYThreshold = options.swipeYThreshold || 50; + const swipeXMaxY = 30; - var excludeTagNames = options.ignoreTagNames || []; + const excludeTagNames = options.ignoreTagNames || []; - var touchStart = function (e) { + const touchStart = function (e) { - var touch = getTouches(e)[0]; + const touch = getTouches(e)[0]; touchTarget = null; touchStartX = 0; touchStartY = 0; @@ -35,7 +35,7 @@ class TouchHelper { if (touch) { - var currentTouchTarget = touch.target; + const currentTouchTarget = touch.target; if (dom.parentWithTag(currentTouchTarget, excludeTagNames)) { return; @@ -47,18 +47,18 @@ class TouchHelper { } }; - var touchEnd = function (e) { + const touchEnd = function (e) { - var isTouchMove = e.type === 'touchmove'; + const isTouchMove = e.type === 'touchmove'; if (touchTarget) { - var touch = getTouches(e)[0]; + const touch = getTouches(e)[0]; - var deltaX; - var deltaY; + let deltaX; + let deltaY; - var clientX; - var clientY; + let clientX; + let clientY; if (touch) { clientX = touch.clientX || 0; @@ -70,8 +70,8 @@ class TouchHelper { deltaY = 0; } - var currentDeltaX = lastDeltaX == null ? deltaX : (deltaX - lastDeltaX); - var currentDeltaY = lastDeltaY == null ? deltaY : (deltaY - lastDeltaY); + const currentDeltaX = lastDeltaX == null ? deltaX : (deltaX - lastDeltaX); + const currentDeltaY = lastDeltaY == null ? deltaY : (deltaY - lastDeltaY); lastDeltaX = deltaX; lastDeltaY = deltaY; @@ -140,11 +140,11 @@ class TouchHelper { } destroy() { - var elem = this.elem; + const elem = this.elem; if (elem) { - var touchStart = this.touchStart; - var touchEnd = this.touchEnd; + const touchStart = this.touchStart; + const touchEnd = this.touchEnd; dom.removeEventListener(elem, 'touchstart', touchStart, { passive: true