From f36b61f0aa57fa3f8e2c2dc8ae2a8718f5c9b4bf Mon Sep 17 00:00:00 2001 From: Raghav Khanna Date: Fri, 13 Mar 2020 13:47:31 +0000 Subject: [PATCH] Clear console on every run --- src/App.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index 6d04839..bdd78a5 100644 --- a/src/App.js +++ b/src/App.js @@ -50,6 +50,7 @@ class App extends React.Component { js: {code: "", markers: [],}, arm: {code: "", markers: [],}, graphData: [{}], + consoleReset: 0 } } @@ -59,7 +60,7 @@ class App extends React.Component { code: newCode, markers: [{startRow: 0, startCol: 2, endRow: 0, endCol: 20, className: 'warning-highlight', type: 'text'}] }, - graphData: [{}] + graphData: [{}], }) } @@ -104,6 +105,9 @@ class App extends React.Component { window.EMULATOR_CONSOLE_READ = () => { return window.prompt()}; }; + clearConsole = () => { + this.setState({consoleReset: this.state.consoleReset + 1}) + } processWaccCode = async (code) => { let rsp = await sendWaccCode(code); let graph = this.state.graphData; @@ -124,8 +128,6 @@ class App extends React.Component { render() { return (
- -
@@ -134,13 +136,15 @@ class App extends React.Component { { this.processWaccCode(this.state.wacc.code) + this.clearConsole() }} onStepJsClick={(e) => { this.setState({js: {code: "Hello World!"}}) }} onStepOverAstClick={(e) => { this.readInputCallBack(e) - }}/> + }} + /> @@ -206,7 +210,7 @@ class App extends React.Component { { window.EMULATOR_CONSOLE_READ = () => {return cmd[0]}; window.EMULATOR_IS_INPUT = true; - }} watchConsoleLogging hideTopBar allowTabs={false}/> + }} watchConsoleLogging hideTopBar allowTabs={false} key={this.state.consoleReset}/>
-- GitLab