update Variable declerations for taskbutton and touchHelper

This commit is contained in:
Cameron 2020-07-17 11:32:23 +01:00
parent 0473e549ab
commit 46638fb9a9
2 changed files with 33 additions and 33 deletions

View File

@ -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('<span style="color:#FF0000;">(' + globalize.translate('LabelFailed') + ')</span>');
@ -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);

View File

@ -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