trigger newScenario event and move out dependency

pull/1/head
Iuri Matias 6 years ago
parent 236f26a839
commit 722bbe73d2
  1. 9
      src/app/tabs/run-tab.js
  2. 13
      src/app/tabs/runTab/recorder.js

@ -93,7 +93,14 @@ function runTab (opts, localRegistry) {
executionContext.event.register('contextChanged', recorder.clearAll.bind(recorder))
self.event.register('clearInstance', recorder.clearAll.bind(recorder))
var recorderInterface = new RecorderUI(recorder, self)
var recorderInterface = new RecorderUI(recorder, self._deps.logCallback)
recorderInterface.event.register('newScenario', (abi, address, contractName) => {
var noInstancesText = this._view.noInstancesText
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
this._view.instanceContainer.appendChild(this._deps.udappUI.renderInstanceFromABI(abi, address, contractName))
})
recorderInterface.render()
self._view.collapsedView = yo`

@ -1,4 +1,6 @@
var yo = require('yo-yo')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var csjs = require('csjs-inject')
var css = require('../styles/run-tab-styles')
@ -8,10 +10,10 @@ var confirmDialog = require('../../execution/confirmDialog')
class RecorderUI {
constructor (recorder, parentSelf) {
constructor (recorder, logCallBack) {
this.recorder = recorder
this.parentSelf = parentSelf
this.logCallBack = this.parentSelf._deps.logCallback
this.logCallBack = logCallBack
this.event = new EventManager()
}
render () {
@ -67,10 +69,7 @@ class RecorderUI {
return modalDialogCustom.alert(error)
}
var noInstancesText = this.parentSelf._view.noInstancesText
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
this.parentSelf._view.instanceContainer.appendChild(this.parentSelf._deps.udappUI.renderInstanceFromABI(abi, address, contractName))
this.event.trigger('newScenario', [abi, address, contractName])
})
}

Loading…
Cancel
Save