move active events

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent 77d6d4ec3b
commit 5367933bd5
  1. 2
      src/app.js
  2. 10
      src/app/debugger/debugger.js
  3. 20
      src/app/debugger/debuggerUI.js
  4. 7
      src/app/tabs/debugger-tab.js

@ -230,7 +230,7 @@ class App {
}
runCompiler () {
const self = this
if (self._components.righthandpanel.debugger().isActive) return
if (self._components.righthandpanel.debugger().isDebuggerActive()) return
self._components.fileManager.saveCurrentFile()
self._components.editorpanel.getEditor().clearAnnotations()

@ -35,7 +35,6 @@ function Debugger (container, sourceHighlighter, localRegistry) {
// TODO: render doesn't exist anymore
container.appendChild(this.debugger_ui.render())
//
this.isActive = false
this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => {
return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this._deps.compiler.lastCompilationResult.source.sources, this._deps.compiler.lastCompilationResult.data.sources)
@ -58,15 +57,6 @@ function Debugger (container, sourceHighlighter, localRegistry) {
self.switchProvider(context)
})
this.debugger.event.register('newTraceLoaded', this, function () {
self.isActive = true
})
this.debugger.event.register('traceUnloaded', this, function () {
self._components.sourceHighlighter.currentSourceLocation(null)
self.isActive = false
})
// unload if a file has changed (but not if tabs were switched)
self._deps.editor.event.register('contentChanged', function () {
self.debugger.unLoad()

@ -10,11 +10,31 @@ class DebuggerUI {
this.transactionDebugger.addProvider('injected', executionContext.internalWeb3())
this.transactionDebugger.addProvider('web3', executionContext.internalWeb3())
this.transactionDebugger.switchProvider(executionContext.getProvider())
this.isActive = false
this.listenToEvents()
}
listenToEvents () {
const self = this
this.transactionDebugger.debugger.event.register('newTraceLoaded', this, function () {
self.isActive = true
})
this.transactionDebugger.debugger.event.register('traceUnloaded', this, function () {
self._components.sourceHighlighter.currentSourceLocation(null)
self.isActive = false
})
}
view () {
return this.transactionDebugger
}
isDebuggerActive () {
return this.isActive
}
}
module.exports = DebuggerUI

@ -38,13 +38,14 @@ class DebuggerTab {
<div id="debugger" class="${css.debugger}"></div>
</div>`
let debuggerUI = new DebuggerUI(self._view.el.querySelector('#debugger'))
self._view.transactionDebugger = debuggerUI.view()
this.debuggerUI = new DebuggerUI(self._view.el.querySelector('#debugger'))
self._view.transactionDebugger = this.debuggerUI.view()
return self._view.el
}
debugger () {
return this._view.transactionDebugger
// return this._view.transactionDebugger
return this.debuggerUI
}
}

Loading…
Cancel
Save