move optimize to settings tab

pull/1/head
yann300 7 years ago
parent 30612fc493
commit e784b2ae1b
  1. 15
      src/app.js
  2. 18
      src/app/tabs/settings-tab.js

@ -594,6 +594,10 @@ function run () {
},
resetDapp: (contracts) => {
udapp.reset(contracts, transactionContextAPI)
},
setOptimize: (optimize, runCompilation) => {
compiler.setOptimize(optimize)
if (runCompilation) runCompiler()
}
}
var rhpEvents = {
@ -1014,17 +1018,6 @@ function run () {
}
}
// set default
$('#optimize').attr('checked', (queryParams.get().optimize === 'true'))
compiler.setOptimize(document.querySelector('#optimize').checked)
document.querySelector('#optimize').addEventListener('change', function () {
var optimize = document.querySelector('#optimize').checked
queryParams.update({ optimize: optimize })
compiler.setOptimize(optimize)
runCompiler()
})
// ----------------- version selector-------------
// clear and disable the version selector

@ -1,4 +1,5 @@
var yo = require('yo-yo')
var QueryParams = require('../../lib/query-params')
// -------------- styling ----------------------
var csjs = require('csjs-inject')
@ -28,6 +29,8 @@ function SettingsTab (container, appAPI, appEvents, opts) {
if (typeof container === 'string') container = document.querySelector(container)
if (!container) throw new Error('no container given')
var queryParams = new QueryParams()
var el = yo`
<div class="${css.settingsTabView} "id="settingsView">
<div class="${css.info}">
@ -47,5 +50,20 @@ function SettingsTab (container, appAPI, appEvents, opts) {
</div>
</div>
`
var optimize = el.querySelector('#optimize')
if ((queryParams.get().optimize === 'true')) {
optimize.setAttribute('checked', true)
appAPI.setOptimize(true, false)
} else {
appAPI.setOptimize(false, false)
}
optimize.addEventListener('change', function () {
var optimize = this.checked
queryParams.update({ optimize: optimize })
appAPI.setOptimize(optimize, true)
})
container.appendChild(el)
}

Loading…
Cancel
Save