Commit f36b61f0 authored by Raghav Khanna's avatar Raghav Khanna

Clear console on every run

parent 38b94d36
...@@ -50,6 +50,7 @@ class App extends React.Component { ...@@ -50,6 +50,7 @@ class App extends React.Component {
js: {code: "", markers: [],}, js: {code: "", markers: [],},
arm: {code: "", markers: [],}, arm: {code: "", markers: [],},
graphData: [{}], graphData: [{}],
consoleReset: 0
} }
} }
...@@ -59,7 +60,7 @@ class App extends React.Component { ...@@ -59,7 +60,7 @@ class App extends React.Component {
code: newCode, code: newCode,
markers: [{startRow: 0, startCol: 2, endRow: 0, endCol: 20, className: 'warning-highlight', type: 'text'}] 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 { ...@@ -104,6 +105,9 @@ class App extends React.Component {
window.EMULATOR_CONSOLE_READ = () => { return window.prompt()}; window.EMULATOR_CONSOLE_READ = () => { return window.prompt()};
}; };
clearConsole = () => {
this.setState({consoleReset: this.state.consoleReset + 1})
}
processWaccCode = async (code) => { processWaccCode = async (code) => {
let rsp = await sendWaccCode(code); let rsp = await sendWaccCode(code);
let graph = this.state.graphData; let graph = this.state.graphData;
...@@ -124,8 +128,6 @@ class App extends React.Component { ...@@ -124,8 +128,6 @@ class App extends React.Component {
render() { render() {
return ( return (
<div className="App"> <div className="App">
<div className="App-code-editors"> <div className="App-code-editors">
<GridContainer> <GridContainer>
<GridItem lg={12}> <GridItem lg={12}>
...@@ -134,13 +136,15 @@ class App extends React.Component { ...@@ -134,13 +136,15 @@ class App extends React.Component {
<ButtonStrip <ButtonStrip
onCompileClick={(e) => { onCompileClick={(e) => {
this.processWaccCode(this.state.wacc.code) this.processWaccCode(this.state.wacc.code)
this.clearConsole()
}} }}
onStepJsClick={(e) => { onStepJsClick={(e) => {
this.setState({js: {code: "Hello World!"}}) this.setState({js: {code: "Hello World!"}})
}} }}
onStepOverAstClick={(e) => { onStepOverAstClick={(e) => {
this.readInputCallBack(e) this.readInputCallBack(e)
}}/> }}
/>
</CardBody> </CardBody>
</Card> </Card>
</GridItem> </GridItem>
...@@ -206,7 +210,7 @@ class App extends React.Component { ...@@ -206,7 +210,7 @@ class App extends React.Component {
<Terminal commandPassThrough={cmd => { <Terminal commandPassThrough={cmd => {
window.EMULATOR_CONSOLE_READ = () => {return cmd[0]}; window.EMULATOR_CONSOLE_READ = () => {return cmd[0]};
window.EMULATOR_IS_INPUT = true; window.EMULATOR_IS_INPUT = true;
}} watchConsoleLogging hideTopBar allowTabs={false}/> }} watchConsoleLogging hideTopBar allowTabs={false} key={this.state.consoleReset}/>
</div> </div>
</CardBody> </CardBody>
</Card> </Card>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment