import React, { PropTypes } from 'react'; import InlineSVG from 'react-inlinesvg'; const upArrowUrl = require('../../../images/up-arrow.svg'); const downArrowUrl = require('../../../images/down-arrow.svg'); import classNames from 'classnames'; /** * How many console messages to store * @type {Number} */ const consoleMax = 100; class Console extends React.Component { constructor(props) { super(props); /** * An array of React Elements that include previous console messages * @type {Array} */ this.children = []; } componentWillReceiveProps(nextProps) { if (nextProps.isPlaying && !this.props.isPlaying) { this.children = []; } else if (nextProps.consoleEvent !== this.props.consoleEvent) { const args = nextProps.consoleEvent.arguments; Object.keys(args).forEach((key) => { if (args[key].includes('Exiting potential infinite loop')) { // stop sketch // dispatch infinite loop found this.props.stopSketch(); this.props.detectInfiniteLoops(); } }); if (nextProps.isExpanded) { // const args = nextProps.consoleEvent.arguments; const method = nextProps.consoleEvent.method; const nextChild = (