diff --git a/client/constants.js b/client/constants.js index 078c617b..b8c3a389 100644 --- a/client/constants.js +++ b/client/constants.js @@ -47,6 +47,7 @@ export const EXPAND_SIDEBAR = 'EXPAND_SIDEBAR'; export const COLLAPSE_SIDEBAR = 'COLLAPSE_SIDEBAR'; export const CONSOLE_EVENT = 'CONSOLE_EVENT'; +export const CLEAR_CONSOLE = 'CLEAR_CONSOLE'; export const EXPAND_CONSOLE = 'EXPAND_CONSOLE'; export const COLLAPSE_CONSOLE = 'COLLAPSE_CONSOLE'; diff --git a/client/modules/IDE/actions/console.js b/client/modules/IDE/actions/console.js new file mode 100644 index 00000000..7cc0d092 --- /dev/null +++ b/client/modules/IDE/actions/console.js @@ -0,0 +1,14 @@ +import * as ActionTypes from '../../../constants'; + +export function clearConsole() { + return { + type: ActionTypes.CLEAR_CONSOLE + }; +} + +export function dispatchConsoleEvent(...args) { + return { + type: ActionTypes.CONSOLE_EVENT, + event: args[0].data + }; +} diff --git a/client/modules/IDE/actions/ide.js b/client/modules/IDE/actions/ide.js index f2cbe395..f66ef395 100644 --- a/client/modules/IDE/actions/ide.js +++ b/client/modules/IDE/actions/ide.js @@ -61,13 +61,6 @@ export function resetSelectedFile(previousId) { }; } -export function dispatchConsoleEvent(...args) { - return { - type: ActionTypes.CONSOLE_EVENT, - event: args[0].data - }; -} - export function newFile() { return { type: ActionTypes.SHOW_MODAL diff --git a/client/modules/IDE/components/Console.jsx b/client/modules/IDE/components/Console.jsx index e7c155ea..aeb67cfc 100644 --- a/client/modules/IDE/components/Console.jsx +++ b/client/modules/IDE/components/Console.jsx @@ -14,13 +14,8 @@ class Console extends React.Component { constructor(props) { super(props); - - /** - * An array of React Elements that include previous console messages - * @type {Array} - */ - this.children = []; this.appendConsoleEvent = this.appendConsoleEvent.bind(this); + this.clearConsole = this.clearConsole.bind(this); } componentWillReceiveProps(nextProps) { @@ -41,11 +36,12 @@ class Console extends React.Component { } } - shouldComponentUpdate(nextProps) { - return (nextProps.consoleEvent !== this.props.consoleEvent) - || (nextProps.isPlaying && !this.props.isPlaying) - || (this.props.isExpanded !== nextProps.isExpanded); - } + // shouldComponentUpdate(nextProps) { + // return (nextProps.consoleEvent !== this.props.consoleEvent) + // || (nextProps.isPlaying && !this.props.isPlaying) + // || (this.props.isExpanded !== nextProps.isExpanded) + // || ; + // } componentDidUpdate() { this.refs.console_messages.scrollTop = this.refs.console_messages.scrollHeight; @@ -71,6 +67,10 @@ class Console extends React.Component { this.children.push(nextChild); } + clearConsole() { + this.children = []; + } + render() { const childrenToDisplay = this.children.slice(-consoleMax); const consoleClass = classNames({ @@ -82,12 +82,17 @@ class Console extends React.Component {