remove no longer necessary registry paramter from udapp constructor

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 2171bd84c4
commit 5dd4e1bd2d
  1. 2
      src/app.js
  2. 6
      src/universal-dapp.js

@ -313,7 +313,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.put({api: self._components.compilersArtefacts, name: 'compilersartefacts'}) registry.put({api: self._components.compilersArtefacts, name: 'compilersartefacts'})
// ----------------- UniversalDApp ----------------- // ----------------- UniversalDApp -----------------
var udapp = new UniversalDApp(registry, registry.get('config').api) var udapp = new UniversalDApp(registry.get('config').api)
registry.put({api: udapp, name: 'udapp'}) registry.put({api: udapp, name: 'udapp'})
udapp.event.register('transactionBroadcasted', (txhash, networkName) => { udapp.event.register('transactionBroadcasted', (txhash, networkName) => {
var txLink = executionContext.txDetailsLink(networkName, txhash) var txLink = executionContext.txDetailsLink(networkName, txhash)

@ -8,16 +8,13 @@ var txHelper = remixLib.execution.txHelper
var EventManager = remixLib.EventManager var EventManager = remixLib.EventManager
var executionContext = remixLib.execution.executionContext var executionContext = remixLib.execution.executionContext
function UniversalDApp (globalRegistry, config) { function UniversalDApp (config) {
this.event = new EventManager() this.event = new EventManager()
var self = this var self = this
self._deps = { self._deps = {
config: globalRegistry.get('config').api, config: globalRegistry.get('config').api,
compiler: globalRegistry.get('compiler').api compiler: globalRegistry.get('compiler').api
} }
executionContext.event.register('contextChanged', this, function (context) {
self.resetEnvironment()
})
self._txRunnerAPI = { self._txRunnerAPI = {
config: self._deps.config, config: self._deps.config,
detectNetwork: (cb) => { detectNetwork: (cb) => {
@ -30,6 +27,7 @@ function UniversalDApp (globalRegistry, config) {
self.txRunner = new TxRunner({}, self._txRunnerAPI) self.txRunner = new TxRunner({}, self._txRunnerAPI)
self.accounts = {} self.accounts = {}
self.resetEnvironment() self.resetEnvironment()
executionContext.event.register('contextChanged', this.resetEnvironment.bind(this))
} }
UniversalDApp.prototype.resetEnvironment = function () { UniversalDApp.prototype.resetEnvironment = function () {

Loading…
Cancel
Save