From 02a19fecbfa3c1c838ebdab7eab0dd9f1ecfc0d1 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 27 Feb 2017 14:51:21 +0200 Subject: [PATCH] chore(dom) swapPanels: es2015-ify --- client/dom/index.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/client/dom/index.js b/client/dom/index.js index 91862b7d..2f5b2bc3 100644 --- a/client/dom/index.js +++ b/client/dom/index.js @@ -1376,15 +1376,18 @@ function CmdProto() { }); }; - this.swapPanels = function() { - var Info = CurrentInfo, - panel = Info.panel, - panelPassive = Info.panelPassive, - - currentIndex = [].indexOf.call(Info.files, Info.element), - - dirPath = DOM.getCurrentDirPath(), - dirPathPassive = DOM.getNotCurrentDirPath(); + this.swapPanels = () => { + const Info = CurrentInfo; + const {panel} = Info; + const {files} = Info; + const {element} = Info; + + const panelPassive = Info.panelPassive; + + const dirPath = DOM.getCurrentDirPath(); + const dirPathPassive = DOM.getNotCurrentDirPath(); + + let currentIndex = files.indexOf(element); CloudCmd.loadDir({ path: dirPath, @@ -1395,15 +1398,14 @@ function CmdProto() { CloudCmd.loadDir({ path: dirPathPassive, panel: panel - }, function() { - var el, - files = Info.files, - length = files.length - 1; + }, () => { + const files = Info.files; + const length = files.length - 1; if (currentIndex > length) currentIndex = length; - el = files[currentIndex]; + const el = files[currentIndex]; DOM.setCurrentFile(el); });