added event listener to runTab settings to listen on personal mode

change event
pull/3094/head
LianaHus 6 years ago
parent 7f0b01aa21
commit 57cd031a24
  1. 25
      src/app/tabs/runTab/settings.js
  2. 4
      src/config.js

@ -24,9 +24,12 @@ class SettingsUI {
this._components.registry = globalRegistry
this._deps = {
networkModule: this._components.registry.get('network').api
networkModule: this._components.registry.get('network').api,
config: this._components.registry.get('config').api
}
this._deps.config.events.on('settings/personal-mode_changed', this.onPersonalChange)
setInterval(() => {
this.updateAccountBalances()
}, 10 * 1000)
@ -215,19 +218,25 @@ class SettingsUI {
}
break
case 'web3': {
if (!this._components.registry.get('config').api.get('settings/personal-mode')) {
plusBtn.classList.add(css.disableMouseEvents)
plusTitle.title = 'Creating an account is possible only in Personal mode. Please go to Settings to enable it.'
} else {
plusBtn.classList.remove(css.disableMouseEvents)
plusTitle.title = 'Create a new account'
}
onPersonalChange()
}
break
default:
}
}
onPersonalChange() {
let plusBtn = document.getElementById('remixRunPlus')
let plusTitle = document.getElementById('remixRunPlusWraper')
if (!this._deps.config.get('settings/personal-mode')) {
plusBtn.classList.add(css.disableMouseEvents)
plusTitle.title = 'Creating an account is possible only in Personal mode. Please go to Settings to enable it.'
} else {
plusBtn.classList.remove(css.disableMouseEvents)
plusTitle.title = 'Create a new account'
}
}
newAccount () {
this.settings.newAccount(
(cb) => {

@ -1,10 +1,12 @@
'use strict'
var CONFIG_FILE = '.remix.config'
const EventEmitter = require('events')
function Config (storage) {
this.items = {}
this.unpersistedItems = {}
this.events = new EventEmitter()
// load on instantiation
try {
@ -28,7 +30,7 @@ function Config (storage) {
this.items[key] = content
try {
storage.set(CONFIG_FILE, JSON.stringify(this.items))
event.emit(key+'_changed', content)
this.events.emit(key+'_changed', content)
} catch (exception) {
}
}

Loading…
Cancel
Save