From 276f194831d1a4aa46c5464b928dfb3af89c51fb Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 3 Oct 2018 13:33:54 -0400 Subject: [PATCH] refactor debug to have a loading callback and move the actual debug call to it --- src/app/debugger/debugger/debugger.js | 5 ++++- src/app/debugger/debuggerUI.js | 17 ++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/debugger/debugger/debugger.js b/src/app/debugger/debugger/debugger.js index 9cd0d22f61..1798f682b0 100644 --- a/src/app/debugger/debugger/debugger.js +++ b/src/app/debugger/debugger/debugger.js @@ -76,7 +76,7 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) { }) } -Debugger.prototype.debug = function (parent) { +Debugger.prototype.debug = function (parent, tx, loadingCb) { const self = this this.step_manager = new StepManager(this.debugger, this.debugger.traceManager) parent.event.register('indexChanged', this, (index) => { @@ -92,6 +92,9 @@ Debugger.prototype.debug = function (parent) { }) this.vmDebuggerLogic = new VmDebuggerLogic(parent, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree) + + loadingCb() + this.debugger.debug(tx) } module.exports = Debugger diff --git a/src/app/debugger/debuggerUI.js b/src/app/debugger/debuggerUI.js index 73a3a332d6..3fbdc030ac 100644 --- a/src/app/debugger/debuggerUI.js +++ b/src/app/debugger/debuggerUI.js @@ -166,16 +166,15 @@ class DebuggerUI { // still here because tx is being reffered in children this.tx = tx - this.transactionDebugger.debug(this) - this.stepManager = new StepManagerUI(this.transactionDebugger.step_manager) - this.stepManager.event.register('stepChanged', this, function (stepIndex) { - self.stepChanged(stepIndex) - }) - - this.vmDebugger = new VmDebugger(this.transactionDebugger.vmDebuggerLogic) - this.andAddVmDebugger() + this.transactionDebugger.debug(this, tx, () => { + self.stepManager = new StepManagerUI(this.transactionDebugger.step_manager) + self.stepManager.event.register('stepChanged', this, function (stepIndex) { + self.stepChanged(stepIndex) + }) - this.transactionDebugger.debugger.debug(tx) + self.vmDebugger = new VmDebugger(this.transactionDebugger.vmDebuggerLogic) + self.andAddVmDebugger() + }) } debug (txHash) {