Commit faab2ff2 authored by Iuri Matias's avatar Iuri Matias Committed by yann300

create event for debugger state; add debug method

parent 80ea6c56
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
var EthdebuggerUI = require('./remix-debugger/src/ui/EthdebuggerUI') var EthdebuggerUI = require('./remix-debugger/src/ui/EthdebuggerUI')
var Ethdebugger = require('remix-debug').EthDebugger var Ethdebugger = require('remix-debug').EthDebugger
var remixLib = require('remix-lib') var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var executionContext = require('../../execution-context') var executionContext = require('../../execution-context')
var globlalRegistry = require('../../global/registry') var globlalRegistry = require('../../global/registry')
...@@ -9,6 +10,9 @@ var globlalRegistry = require('../../global/registry') ...@@ -9,6 +10,9 @@ var globlalRegistry = require('../../global/registry')
* Manage remix and source highlighting * Manage remix and source highlighting
*/ */
function Debugger (container, sourceHighlighter, localRegistry) { function Debugger (container, sourceHighlighter, localRegistry) {
var self = this
this.event = new EventManager()
this._components = { this._components = {
sourceHighlighter: sourceHighlighter sourceHighlighter: sourceHighlighter
} }
...@@ -44,7 +48,6 @@ function Debugger (container, sourceHighlighter, localRegistry) { ...@@ -44,7 +48,6 @@ function Debugger (container, sourceHighlighter, localRegistry) {
this.debugger.setBreakpointManager(this.breakPointManager) this.debugger.setBreakpointManager(this.breakPointManager)
var self = this
self._deps.editor.event.register('breakpointCleared', (fileName, row) => { self._deps.editor.event.register('breakpointCleared', (fileName, row) => {
this.breakPointManager.remove({fileName: fileName, row: row}) this.breakPointManager.remove({fileName: fileName, row: row})
}) })
...@@ -78,6 +81,15 @@ function Debugger (container, sourceHighlighter, localRegistry) { ...@@ -78,6 +81,15 @@ function Debugger (container, sourceHighlighter, localRegistry) {
}) })
} }
}) })
this.debugger.event.register('newTraceLoaded', this, function () {
self.event.trigger('debuggerStatus', [true])
})
this.debugger.event.register('traceUnloaded', this, function () {
self._components.sourceHighlighter.currentSourceLocation(null)
self.event.trigger('debuggerStatus', [false])
})
} }
/** /**
......
...@@ -18,13 +18,8 @@ class DebuggerUI { ...@@ -18,13 +18,8 @@ class DebuggerUI {
listenToEvents () { listenToEvents () {
const self = this const self = this
this.transactionDebugger.debugger.event.register('newTraceLoaded', this, function () { this.transactionDebugger.event.register('debuggerStatus', function (isActive) {
self.isActive = true self.isActive = isActive
})
this.transactionDebugger.debugger.event.register('traceUnloaded', this, function () {
self._components.sourceHighlighter.currentSourceLocation(null)
self.isActive = false
}) })
} }
...@@ -35,6 +30,10 @@ class DebuggerUI { ...@@ -35,6 +30,10 @@ class DebuggerUI {
isDebuggerActive () { isDebuggerActive () {
return this.isActive return this.isActive
} }
debug(txHash) {
this.transactionDebugger.debug(txHash)
}
} }
module.exports = DebuggerUI module.exports = DebuggerUI
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment