From 1309e093bb4340c2e1816c2408cf94bf00f5c57d Mon Sep 17 00:00:00 2001 From: Rob Stupay Date: Mon, 4 Sep 2017 17:54:09 +0200 Subject: [PATCH] cleaner version of #747 --- src/app.js | 11 +++++++++-- src/app/tabs/run-tab.js | 1 + src/universal-dapp.js | 13 ++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app.js b/src/app.js index a1111dc898..a8a728e763 100644 --- a/src/app.js +++ b/src/app.js @@ -343,8 +343,12 @@ function run () { } var udapp = new UniversalDApp({ - removable: false, - removable_instances: true + api: { + logMessage: (msg) => { + self._components.editorpanel.log({ type: 'log', value: msg }) + } + }, + opt: { removable: false, removable_instances: true } }) udapp.reset({}, transactionContextAPI) udapp.event.register('debugRequested', this, function (txResult) { @@ -402,6 +406,9 @@ function run () { }, runCompiler: () => { runCompiler() + }, + logMessage: (msg) => { + self._components.editorpanel.log({type: 'log', value: msg}) } } var rhpEvents = { diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index b4249c3de9..0cf97bb140 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -300,6 +300,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) { var args = createButtonInput.value txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), (error, data) => { if (!error) { + appAPI.logMessage('transaction added ...') txExecution.createContract(data, appAPI.udapp(), (error, txResult) => { if (!error) { var isVM = executionContext.isVM() diff --git a/src/universal-dapp.js b/src/universal-dapp.js index a376826154..040de1d3b5 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -96,13 +96,16 @@ var css = csjs` /* trigger debugRequested */ -function UniversalDApp (options) { +function UniversalDApp (opts = {}) { this.event = new EventManager() var self = this - self.options = options || {} + self._api = opts.api + self.removable = opts.opt.removable + self.removable_instance = opts.opt.removable_instance + // self.options = options || {} self.el = yo`
` - self.personalMode = self.options.personalMode || false + self.personalMode = opts.opt.personalMode || false self.contracts self.transactionContextAPI executionContext.event.register('contextChanged', this, function (context) { @@ -229,8 +232,7 @@ UniversalDApp.prototype.renderInstance = function (contract, address, contractNa
${contractName} at ${shortAddress} (${context})
` - - if (this.options.removable_instances) { + if (this.removable_instance) { var close = yo`
` title.appendChild(close) } @@ -308,6 +310,7 @@ UniversalDApp.prototype.getCallButton = function (args) { if (!error) { txExecution.callFunction(args.address, data, args.funABI, self, (error, txResult) => { if (!error) { + self._api.logMessage('UDApp transaction added ...') var isVM = executionContext.isVM() if (isVM) { var vmError = txExecution.checkVMError(txResult)