From e379f8ec03c9b350937ef78331c0e1a0f5364838 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Wed, 17 Jul 2013 13:08:38 -0700 Subject: [PATCH] Fix all errors and warnings on homepage Also onChange instead of onInput in two places! --- docs/_js/examples/timer.js | 5 ++++- docs/_js/examples/todo.js | 4 ++-- docs/_js/live_editor.js | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/_js/examples/timer.js b/docs/_js/examples/timer.js index 68f4f657612..eb1fed09aa2 100644 --- a/docs/_js/examples/timer.js +++ b/docs/_js/examples/timer.js @@ -11,7 +11,10 @@ var Timer = React.createClass({\n\ this.setState({secondsElapsed: this.state.secondsElapsed + 1});\n\ },\n\ componentDidMount: function() {\n\ - setInterval(this.tick, 1000);\n\ + this.interval = setInterval(this.tick, 1000);\n\ + },\n\ + componentWillUnmount: function() {\n\ + clearInterval(this.interval);\n\ },\n\ render: function() {\n\ return React.DOM.div({},\n\ diff --git a/docs/_js/examples/todo.js b/docs/_js/examples/todo.js index 9798cb9fa14..ebc08d5f50a 100644 --- a/docs/_js/examples/todo.js +++ b/docs/_js/examples/todo.js @@ -16,7 +16,7 @@ var TodoApp = React.createClass({\n\ getInitialState: function() {\n\ return {items: [], text: ''};\n\ },\n\ - onKey: function(e) {\n\ + onChange: function(e) {\n\ this.setState({text: e.target.value});\n\ },\n\ handleSubmit: function(e) {\n\ @@ -31,7 +31,7 @@ var TodoApp = React.createClass({\n\

TODO

\n\ \n\
\n\ - \n\ + \n\ \n\
\n\ \n\ diff --git a/docs/_js/live_editor.js b/docs/_js/live_editor.js index 8e9814fe626..de0057389dd 100644 --- a/docs/_js/live_editor.js +++ b/docs/_js/live_editor.js @@ -24,7 +24,7 @@ var CodeMirrorEditor = React.createClass({ matchBrackets: true, theme: 'solarized-light' }); - this.editor.on('change', this.onChange.bind(this)); + this.editor.on('change', this.onChange); this.onChange(); }, onChange: function() { @@ -40,7 +40,7 @@ var CodeMirrorEditor = React.createClass({ if (IS_MOBILE) { editor =
{this.props.codeText}
; } else { - editor = ; + editor =