Skip to content

Commit 0c1f272

Browse files
committed
Remove React.autoBind from examples
1 parent 75f7f1e commit 0c1f272

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

examples/ballmer-peak/example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ var BallmerPeakCalculator = React.createClass({
1414
getInitialState: function() {
1515
return {bac: 0};
1616
},
17-
handleChange: React.autoBind(function() {
17+
handleChange: function() {
1818
this.setState({bac: this.refs.bac.getDOMNode().value});
19-
}),
19+
},
2020
render: function() {
2121
var bac;
2222
var pct;

examples/jquery-bootstrap/js/app.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ var BootstrapModal = React.createClass({
6767
</div>
6868
);
6969
},
70-
onCancel: React.autoBind(function() {
70+
onCancel: function() {
7171
if (this.props.onCancel) {
7272
this.props.onCancel();
7373
}
7474
this.close();
75-
}),
76-
onConfirm: React.autoBind(function() {
75+
},
76+
onConfirm: function() {
7777
if (this.props.onConfirm) {
7878
this.props.onConfirm();
7979
}
8080
this.close();
81-
}),
81+
},
8282
close: function() {
8383
if (this.props.onClose) {
8484
this.props.onClose();
@@ -90,14 +90,14 @@ var Example = React.createClass({
9090
getInitialState: function() {
9191
return {modalVisible: false};
9292
},
93-
toggleModal: React.autoBind(function() {
93+
toggleModal: function() {
9494
this.setState({modalVisible: !this.state.modalVisible});
95-
}),
96-
handleCancel: React.autoBind(function() {
95+
},
96+
handleCancel: function() {
9797
if (confirm('Are you sure you want to cancel?')) {
9898
this.toggleModal();
9999
}
100-
}),
100+
},
101101
render: function() {
102102
var modal = null;
103103
if (this.state.modalVisible) {
@@ -121,4 +121,4 @@ var Example = React.createClass({
121121
}
122122
});
123123

124-
React.renderComponent(<Example />, document.getElementById('jqueryexample'));
124+
React.renderComponent(<Example />, document.getElementById('jqueryexample'));

examples/todomvc-backbone/js/app.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ var Utils = {
7474
// Begin React stuff
7575

7676
var TodoItem = React.createClass({
77-
handleSubmit: React.autoBind(function(event) {
77+
handleSubmit: function(event) {
7878
var val = this.refs.editField.getDOMNode().value;
7979
if (val) {
8080
this.props.onSave(val);
8181
}
8282
return false;
83-
}),
84-
onEdit: React.autoBind(function() {
83+
},
84+
onEdit: function() {
8585
this.props.onEdit();
8686
this.refs.editField.getDOMNode().focus();
87-
}),
87+
},
8888
render: function() {
8989
return (
9090
<li class={cx({completed: this.props.todo.get('completed'), editing: this.props.editing})}>
@@ -166,7 +166,7 @@ var TodoApp = React.createClass({
166166
getBackboneModels: function() {
167167
return [this.props.todos];
168168
},
169-
handleSubmit: React.autoBind(function() {
169+
handleSubmit: function() {
170170
var val = this.refs.newField.getDOMNode().value.trim();
171171
if (val) {
172172
this.props.todos.create({
@@ -177,13 +177,13 @@ var TodoApp = React.createClass({
177177
this.refs.newField.getDOMNode().value = '';
178178
}
179179
return false;
180-
}),
181-
toggleAll: React.autoBind(function(event) {
180+
},
181+
toggleAll: function(event) {
182182
var checked = event.nativeEvent.target.checked;
183183
this.props.todos.map(function(todo) {
184184
todo.set('completed', checked);
185185
});
186-
}),
186+
},
187187
destroy: function(todo) {
188188
this.props.todos.remove(todo);
189189
},
@@ -194,11 +194,11 @@ var TodoApp = React.createClass({
194194
todo.set('title', text);
195195
this.setState({editing: null});
196196
},
197-
clearCompleted: React.autoBind(function() {
197+
clearCompleted: function() {
198198
this.props.todos.completed().map(function(todo) {
199199
todo.destroy();
200200
});
201-
}),
201+
},
202202
render: function() {
203203
var footer = null;
204204
var main = null;

examples/todomvc/js/app.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ function cx(obj) {
3232
}
3333

3434
var TodoItem = React.createClass({
35-
handleSubmit: React.autoBind(function() {
35+
handleSubmit: function() {
3636
var val = this.state.editText;
3737
if (val) {
3838
this.props.onSave(val);
3939
this.setState({editField: ''});
4040
}
4141
return false;
42-
}),
43-
handleEdit: React.autoBind(function() {
42+
},
43+
handleEdit: function() {
4444
this.props.onEdit();
4545
this.refs.editField.getDOMNode().focus();
46-
}),
47-
handleKey: React.autoBind(function(event) {
46+
},
47+
handleKey: function(event) {
4848
if (event.nativeEvent.keyCode === 27) {
4949
this.handleSubmit();
5050
}
5151
this.setState({editText: event.target.value});
52-
}),
52+
},
5353
getInitialState: function() {
5454
return {editText: this.props.todo.title};
5555
},
@@ -114,7 +114,7 @@ var TodoApp = React.createClass({
114114
};
115115
},
116116

117-
handleSubmit: React.autoBind(function() {
117+
handleSubmit: function() {
118118
var val = this.refs.newField.getDOMNode().value.trim();
119119
if (val) {
120120
var todos = this.state.todos;
@@ -127,7 +127,7 @@ var TodoApp = React.createClass({
127127
this.refs.newField.getDOMNode().value = '';
128128
}
129129
return false;
130-
}),
130+
},
131131

132132
toggleAll: function(event) {
133133
var checked = event.nativeEvent.target.checked;

0 commit comments

Comments
 (0)