From 076bd377b5567d882b68e55d5633c3cf04da148f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 5 Sep 2018 18:05:33 -0400 Subject: [PATCH] move provider change event out of tx browser; simplify set default values --- src/app/debugger/debuggerUI.js | 4 ++++ src/app/debugger/debuggerUI/TxBrowser.js | 21 +++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/app/debugger/debuggerUI.js b/src/app/debugger/debuggerUI.js index ecdd1923cd..57fba2347c 100644 --- a/src/app/debugger/debuggerUI.js +++ b/src/app/debugger/debuggerUI.js @@ -53,6 +53,10 @@ class DebuggerUI { self.debugger_ui.unLoad() }) + this.debugger_ui.event.register('providerChanged', this, function (provider) { + txBrowser.setDefaultValues() + }) + this.txBrowser = this.debugger_ui.txBrowser } diff --git a/src/app/debugger/debuggerUI/TxBrowser.js b/src/app/debugger/debuggerUI/TxBrowser.js index 9205bace02..a3dae4fa76 100644 --- a/src/app/debugger/debuggerUI/TxBrowser.js +++ b/src/app/debugger/debuggerUI/TxBrowser.js @@ -53,14 +53,15 @@ function TxBrowser (_parent, opts) { this.txNumber this.view this.web3 = opts.web3 - var self = this - _parent.event.register('providerChanged', this, function (provider) { - self.setDefaultValues() - // TODO: looks redudant since setDefaultValues already re-renders - if (self.view) { - yo.update(self.view, self.render()) - } - }) + this.setDefaultValues() + // var self = this + // _parent.event.register('providerChanged', this, function (provider) { + // self.setDefaultValues() + // // TODO: looks redudant since setDefaultValues already re-renders + // if (self.view) { + // yo.update(self.view, self.render()) + // } + // }) } TxBrowser.prototype.setDefaultValues = function () { @@ -134,10 +135,6 @@ TxBrowser.prototype.load = function (txHash, tx) { TxBrowser.prototype.unload = function (txHash) { this.event.trigger('unloadRequested') - this.init() -} - -TxBrowser.prototype.init = function (ev) { this.setDefaultValues() }