diff --git a/src/app.js b/src/app.js index 4ebd885dfe..8f1faab652 100644 --- a/src/app.js +++ b/src/app.js @@ -423,7 +423,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org let compileTab = new CompileTab(self._components.registry) let tabs = { compile: compileTab, - run: new RunTab(self._components.registry), + run: new RunTab( + registry.get('udapp').api, + registry.get('udappUI').api, + registry.get('config').api, + registry.get('filemanager').api, + registry.get('editor').api, + registry.get('logCallback').api, + registry.get('filepanel').api, + registry.get('pluginmanager').api, + registry.get('compilersartefacts').api + ), settings: new SettingsTab(self._components.registry), analysis: new AnalysisTab(self._components.registry), debug: new DebuggerTab(self._components.registry), diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 02b6a428af..00c791ddcb 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -17,18 +17,14 @@ var RecorderUI = require('./runTab/recorder.js') class RunTab { - constructor () { + constructor (udapp, udappUI, config, fileManager, editor, logCallback, filePanel, pluginManager, compilersArtefacts) { var self = this - self.event = new EventManager() - self._view = {} - self.data = { - count: 0, - text: `All transactions (deployed contracts and function executions) in this environment can be saved and replayed in - another environment. e.g Transactions created in Javascript VM can be replayed in the Injected Web3.` - } - self._components = {} - self._components.registry = globalRegistry - self._components.transactionContextAPI = { + this.event = new EventManager() + + this._view = {} + this.registry = globalRegistry + + this.transactionContextAPI = { getAddress: (cb) => { cb(null, $('#txorigin').val()) }, @@ -51,19 +47,7 @@ class RunTab { cb(null, $('#gasLimit').val()) } } - // dependencies - self._deps = { - udapp: self._components.registry.get('udapp').api, - udappUI: self._components.registry.get('udappUI').api, - config: self._components.registry.get('config').api, - fileManager: self._components.registry.get('filemanager').api, - editor: self._components.registry.get('editor').api, - logCallback: self._components.registry.get('logCallback').api, - filePanel: self._components.registry.get('filepanel').api, - pluginManager: self._components.registry.get('pluginmanager').api, - compilersArtefacts: self._components.registry.get('compilersartefacts').api - } - self._deps.udapp.resetAPI(self._components.transactionContextAPI) + udapp.resetAPI(this.transactionContextAPI) self._view.recorderCount = yo`0` self._view.instanceContainer = yo`
` self._view.clearInstanceElement = yo` @@ -83,24 +67,22 @@ class RunTab { var container = yo`` - var recorder = new Recorder(self._deps.udapp, self._deps.fileManager, self._deps.config) + var recorder = new Recorder(udapp, fileManager, config) recorder.event.register('newTxRecorded', (count) => { - this.data.count = count this._view.recorderCount.innerText = count }) recorder.event.register('cleared', () => { - this.data.count = 0 this._view.recorderCount.innerText = 0 }) executionContext.event.register('contextChanged', recorder.clearAll.bind(recorder)) self.event.register('clearInstance', recorder.clearAll.bind(recorder)) - var recorderInterface = new RecorderUI(recorder, self._deps.logCallback) + var recorderInterface = new RecorderUI(recorder, 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)) + this._view.instanceContainer.appendChild(udappUI.renderInstanceFromABI(abi, address, contractName)) }) recorderInterface.render() @@ -113,7 +95,8 @@ class RunTab { self._view.expandedView = yo`