don't clear ui if just running a script

pull/2244/head^2
yann300 3 years ago
parent 0cdbd0a56e
commit 4b4c611380
  1. 12
      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)
await this.call('udapp', 'clearAllInstances')
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