cleaner version of #747

pull/1/head
Rob Stupay 7 years ago
parent dd6a7a8565
commit 1309e093bb
  1. 11
      src/app.js
  2. 1
      src/app/tabs/run-tab.js
  3. 13
      src/universal-dapp.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 = {

@ -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()

@ -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`<div class="udapp"></div>`
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
<div class="${css.titleText}"> ${contractName} at ${shortAddress} (${context}) </div>
<i class="fa fa-clipboard ${css.copy}" aria-hidden="true" onclick=${copyToClipboard} title='Copy to clipboard'></i>
</div>`
if (this.options.removable_instances) {
if (this.removable_instance) {
var close = yo`<div class="${css.udappClose}" onclick=${remove}><i class="${css.closeIcon} fa fa-close" aria-hidden="true"></i></div>`
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)

Loading…
Cancel
Save