Skip to content

Commit

Permalink
ADD settings option always-use-vm
Browse files Browse the repository at this point in the history
  • Loading branch information
serapath committed Dec 13, 2017
1 parent 04aab0c commit de1ab8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/tabs/run-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,15 @@ function settings (container, appAPI, appEvents) {
</div>
`

setTimeout(function () {
var select = document.querySelector('#selectExEnvOptions')
var optionVMindex = 0
if (appAPI.config.get('settings/always-use-vm')) {
// select.options[optionVMindex].selected = true
select.selectedIndex = optionVMindex
}
}, 0)

// EVENTS
appEvents.udapp.register('transactionExecuted', (error, from, to, data, lookupOnly, txResult) => {
if (error) return
Expand Down
10 changes: 10 additions & 0 deletions src/app/tabs/settings-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function SettingsTab (container, appAPI, appEvents, opts) {

var queryParams = new QueryParams()

var optionVM = yo`<input class="${css.col1}" id="alwaysUseVM" type="checkbox">`
var el = yo`
<div class="${css.settingsTabView} "id="settingsView">
<div class="${css.info}">
Expand All @@ -56,6 +57,10 @@ function SettingsTab (container, appAPI, appEvents, opts) {
<div><input class="${css.col1}" id="editorWrap" type="checkbox"></div>
<span class="${css.checkboxText}">Text Wrap</span>
</div>
<div class="${css.crow}">
<div>${optionVM}</div>
<span class="${css.checkboxText}">Always use VM</span>
</div>
<div class="${css.crow}">
<div><input class="${css.col1}" id="optimize" type="checkbox"></div>
<span class="${css.checkboxText}">Enable Optimization</span>
Expand All @@ -67,6 +72,11 @@ function SettingsTab (container, appAPI, appEvents, opts) {
setVersionText(version, el)
})

optionVM.checked = appAPI.config.get('settings/always-use-vm') || false
optionVM.addEventListener('change', event => {
appAPI.config.set('settings/always-use-vm', !appAPI.config.get('settings/always-use-vm'))
})

var optimize = el.querySelector('#optimize')
if ((queryParams.get().optimize === 'true')) {
optimize.setAttribute('checked', true)
Expand Down

0 comments on commit de1ab8f

Please sign in to comment.