From c291bec9bde7318414f033f0da3afe1346007c78 Mon Sep 17 00:00:00 2001 From: serapath Date: Sat, 19 May 2018 01:51:25 -0400 Subject: [PATCH] CompileTab: refactor merge event listener --- src/app/tabs/compile-tab.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 02d7e8979e..47bafa0f0e 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -55,15 +55,6 @@ class CompileTab { warnCompilationSlow.style.display = 'none' compileIcon.setAttribute('title', 'compiler is loading, please wait a few moments.') }) - self._events.compiler.register('compilationFinished', function finish () { - if (!compileIcon) return - var compileTab = document.querySelector('.compileView') - compileTab.style.color = styles.colors.black - compileIcon.style.color = styles.colors.black - compileIcon.classList.remove(`${css.spinningIcon}`) - compileIcon.classList.remove(`${css.bouncingIcon}`) - compileIcon.setAttribute('title', 'idle') - }) self._events.compiler.register('compilationStarted', function start () { if (!compileIcon) return errorContainer.innerHTML = '' @@ -76,7 +67,15 @@ class CompileTab { compileIcon.classList.remove(`${css.spinningIcon}`) compileIcon.setAttribute('title', '') }) - self._events.compiler.register('compilationFinished', function (success, data, source) { + self._events.compiler.register('compilationFinished', function finish (success, data, source) { + if (compileIcon) { + var compileTab = document.querySelector('.compileView') + compileTab.style.color = styles.colors.black + compileIcon.style.color = styles.colors.black + compileIcon.classList.remove(`${css.spinningIcon}`) + compileIcon.classList.remove(`${css.bouncingIcon}`) + compileIcon.setAttribute('title', 'idle') + } // reset the contractMetadata list (used by the publish action) self.data.contractsDetails = {} // refill the dropdown list