don't clear ui if just running a script

auto_exec_v2
yann300 3 years ago
parent d7d31dd88d
commit 6492dcbb14
  1. 10
      apps/remix-ide/src/app/tabs/intelligent-script-executor.ts

@ -26,18 +26,20 @@ export class IntelligentScriptExecutor extends Plugin {
e.preventDefault()
this.targetFileName = file
await this.call('solidity', 'compile', file)
} else if (file.endsWith('.js')) {
} else if (file.endsWith('.js') || file.endsWith('.ts')) {
e.preventDefault()
this.runScript(file)
this.runScript(file, false)
}
}
}
}
async runScript (fileName) {
async runScript (fileName, clearAllInstances) {
await this.call('terminal', 'log', `running ${fileName} ...`)
const content = await this.call('fileManager', 'readFile', fileName)
if (clearAllInstances) {
await this.call('udapp', 'clearAllInstances')
}
await this.call('scriptRunner', 'execute', content)
}
@ -48,7 +50,7 @@ export class IntelligentScriptExecutor extends Plugin {
if (this.targetFileName === contract.file && contract.object && contract.object.devdoc['custom:dev-run-script']) {
this.targetFileName = null
const file = contract.object.devdoc['custom:dev-run-script']
if (file) this.runScript(file)
if (file) this.runScript(file, true)
}
})
}

Loading…
Cancel
Save