move provider set into debugger class

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent faab2ff24b
commit f59d81b56c
  1. 45
      src/app/debugger/debugger.js
  2. 9
      src/app/debugger/debuggerUI.js

@ -82,6 +82,8 @@ function Debugger (container, sourceHighlighter, localRegistry) {
}
})
// ====================
// listen to events
this.debugger.event.register('newTraceLoaded', this, function () {
self.event.trigger('debuggerStatus', [true])
})
@ -90,6 +92,13 @@ function Debugger (container, sourceHighlighter, localRegistry) {
self._components.sourceHighlighter.currentSourceLocation(null)
self.event.trigger('debuggerStatus', [false])
})
// ====================
// add providers
this.debugger.addProvider('vm', executionContext.vm())
this.debugger.addProvider('injected', executionContext.internalWeb3())
this.debugger.addProvider('web3', executionContext.internalWeb3())
this.debugger.switchProvider(executionContext.getProvider())
}
/**
@ -107,24 +116,24 @@ Debugger.prototype.debug = function (txHash) {
})
}
/**
* add a new web3 provider to remix
*
* @param {String} type - type/name of the provider to add
* @param {Object} obj - provider
*/
Debugger.prototype.addProvider = function (type, obj) {
this.debugger.addProvider(type, obj)
}
/**
* switch the provider
*
* @param {String} type - type/name of the provider to use
*/
Debugger.prototype.switchProvider = function (type) {
this.debugger.switchProvider(type)
}
// /**
// * add a new web3 provider to remix
// *
// * @param {String} type - type/name of the provider to add
// * @param {Object} obj - provider
// */
// Debugger.prototype.addProvider = function (type, obj) {
// this.debugger.addProvider(type, obj)
// }
// /**
// * switch the provider
// *
// * @param {String} type - type/name of the provider to use
// */
// Debugger.prototype.switchProvider = function (type) {
// this.debugger.switchProvider(type)
// }
/**
* get the current provider

@ -1,18 +1,11 @@
var Debugger = require('../debugger/debugger')
var executionContext = require('../../execution-context')
var SourceHighlighter = require('../editor/sourceHighlighter')
class DebuggerUI {
constructor (container) {
this.transactionDebugger = new Debugger(container, new SourceHighlighter())
this.transactionDebugger.addProvider('vm', executionContext.vm())
this.transactionDebugger.addProvider('injected', executionContext.internalWeb3())
this.transactionDebugger.addProvider('web3', executionContext.internalWeb3())
this.transactionDebugger.switchProvider(executionContext.getProvider())
this.isActive = false
this.listenToEvents()
}
@ -31,7 +24,7 @@ class DebuggerUI {
return this.isActive
}
debug(txHash) {
debug (txHash) {
this.transactionDebugger.debug(txHash)
}
}

Loading…
Cancel
Save