From d5cb4fe7bf4591290ef86bb2b680277b25fc7464 Mon Sep 17 00:00:00 2001 From: serapath Date: Sat, 19 May 2018 23:42:02 -0400 Subject: [PATCH] CompileTab: minor refactorings --- src/app/tabs/compile-tab.js | 42 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index b303c669f1..413c9aaa91 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -18,10 +18,12 @@ module.exports = class CompileTab { self._api = api self._events = events self._view = { - el: null + el: null, + autoCompile: null, + compileButton: null } self.data = { - autoCompile: self._opts.config.get('autoCompile') || false, + autoCompile: self._opts.config.get('autoCompile'), compileTimeout: null, contractsDetails: {}, maxTime: 1000, @@ -120,32 +122,34 @@ module.exports = class CompileTab { // Containers var warnCompilationSlow = yo`` var compileIcon = yo`` + self._view.compileButton = yo`
${compileIcon} Start to compile
` + self._view.autoCompile = yo`` + if (self.data.autoCompile) self._view.autoCompile.setAttribute('checked', '') var compileContainer = yo`
-
${compileIcon} Start to compile
+ ${self._view.compileButton}
- + ${self._view.autoCompile} Auto compile
${warnCompilationSlow}
` - compileContainer.querySelector('#compile').addEventListener('click', () => { - self._api.runCompiler() - }) - var autoCompileInput = compileContainer.querySelector('#autoCompile') - var autoCompile = false - if (opts.config.exists('autoCompile')) { - autoCompile = opts.config.get('autoCompile') - } - opts.config.set('autoCompile', autoCompile) - if (autoCompile) { - autoCompileInput.setAttribute('checked', autoCompile) - } - autoCompileInput.addEventListener('change', function () { - opts.config.set('autoCompile', autoCompileInput.checked) - }) + function updateAutoCompile (event) { self._opts.config.set('autoCompile', self._view.autoCompile.checked) } + function compile (event) { self._api.runCompiler() } + // compileContainer.querySelector('#compile').addEventListener('click', () => { + // self._api.runCompiler() + // }) + // var autoCompileInput = compileContainer.querySelector('#autoCompile') + // var autoCompile = false + // if (opts.config.exists('autoCompile')) { + // autoCompile = opts.config.get('autoCompile') + // } + // opts.config.set('autoCompile', autoCompile) + // self._view.autoCompile.addEventListener('change', function () { + // + // }) var errorContainer = yo`
` var contractsDetails = {} var contractEl = yo`