handleDemo: function() { Parse.Analytics.track('runDemo', {world:this.props.worldModel.id}); this.handleReset(); var demoSolution = this.props.worldModel.get('solution'); var lines = demoSolution.split('\n'); program = parser.newParser(lines, this.refs.worldCanvas.world.robot).parse(); this.runner = new Runner(program, this.refs.worldCanvas.renderer); this.setState({runState: "demo"}); this.runner.run( this.getSpeed(), this.handleRunnerStopped ); },
handleRun: function() { Parse.Analytics.track('runProgram', {world:this.props.worldModel.id}); this.handleSave(); this.handleReset(); var lines = this.refs.codeEditor.getDOMNode().value.split('\n'); try { this.program = parser.newParser(lines, this.refs.worldCanvas.world.robot).parse(); } catch (e) { this.setState({runState:"", errors:[e]}); return } this.refs.codeEditor.setState({editing:false}); this.runner = new Runner(this.program, this.refs.worldCanvas.renderer); this.handleContinue(); },
handleSpeedClick: function(speed) { this.setState({speed:speed}); Parse.Analytics.track('setSpeed', {speed:speed, world:this.props.worldModel.id}); },
success: function(program) { Parse.Analytics.track('finishedWorld', {world:this.props.worldModel.id}); this.setState({programModel:program}); this.props.onFinished(program); }.bind(this)