Merge pull request #931 from ethereum/settings

ADD settings option always-use-vm
pull/3094/head
yann300 7 years ago committed by GitHub
commit 67b1e96435
  1. 1
      src/app.js
  2. 10
      src/app/tabs/settings-tab.js
  3. 11
      src/execution-context.js

@ -109,6 +109,7 @@ class App {
self._api = {} self._api = {}
var fileStorage = new Storage('sol:') var fileStorage = new Storage('sol:')
self._api.config = new Config(fileStorage) self._api.config = new Config(fileStorage)
executionContext.init(self._api.config)
self._api.filesProviders = {} self._api.filesProviders = {}
self._api.filesProviders['browser'] = new Browserfiles(fileStorage) self._api.filesProviders['browser'] = new Browserfiles(fileStorage)
self._api.filesProviders['localhost'] = new SharedFolder(new Remixd()) self._api.filesProviders['localhost'] = new SharedFolder(new Remixd())

@ -43,6 +43,7 @@ function SettingsTab (container, appAPI, appEvents, opts) {
var queryParams = new QueryParams() var queryParams = new QueryParams()
var optionVM = yo`<input class="${css.col1}" id="alwaysUseVM" type="checkbox">`
var el = yo` var el = yo`
<div class="${css.settingsTabView} "id="settingsView"> <div class="${css.settingsTabView} "id="settingsView">
<div class="${css.info}"> <div class="${css.info}">
@ -56,6 +57,10 @@ function SettingsTab (container, appAPI, appEvents, opts) {
<div><input class="${css.col1}" id="editorWrap" type="checkbox"></div> <div><input class="${css.col1}" id="editorWrap" type="checkbox"></div>
<span class="${css.checkboxText}">Text Wrap</span> <span class="${css.checkboxText}">Text Wrap</span>
</div> </div>
<div class="${css.crow}">
<div>${optionVM}</div>
<span class="${css.checkboxText}">Always use VM at Load</span>
</div>
<div class="${css.crow}"> <div class="${css.crow}">
<div><input class="${css.col1}" id="optimize" type="checkbox"></div> <div><input class="${css.col1}" id="optimize" type="checkbox"></div>
<span class="${css.checkboxText}">Enable Optimization</span> <span class="${css.checkboxText}">Enable Optimization</span>
@ -67,6 +72,11 @@ function SettingsTab (container, appAPI, appEvents, opts) {
setVersionText(version, el) 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') var optimize = el.querySelector('#optimize')
if ((queryParams.get().optimize === 'true')) { if ((queryParams.get().optimize === 'true')) {
optimize.setAttribute('checked', true) optimize.setAttribute('checked', true)

@ -82,7 +82,16 @@ var mainNetGenesisHash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec
function ExecutionContext () { function ExecutionContext () {
var self = this var self = this
this.event = new EventManager() this.event = new EventManager()
var executionContext = 'vm'
var executionContext = null
this.init = function (config) {
if (config.get('settings/always-use-vm')) {
executionContext = 'vm'
} else {
executionContext = injectedProvider ? 'injected' : 'vm'
}
}
this.getProvider = function () { this.getProvider = function () {
return executionContext return executionContext

Loading…
Cancel
Save