@samitouri / QOS-React-2 / commits / f1508c4937

Use .bind when autobinding

This eliminates all of the `boundMethod` frames from call stacks when debugging and as far as I know should behave the same otherwise. Test Plan: jest

Ben Alpert committed Jul 24, 2014 at 12:11 UTC f1508c49371dd050c09c1ae39d02fb9a5542e6ef
2 files changed +2 -4
src/core/ReactCompositeComponent.js
+1 -3
@@ -1265,9 +1265,7 @@ var ReactCompositeComponentMixin = {
1265 */
1266 _bindAutoBindMethod: function(method) {
1267 var component = this;
1268 - var boundMethod = function() {
1269 - return method.apply(component, arguments);
1270 - };
1268 + var boundMethod = method.bind(component);
1269 if (__DEV__) {
1270 boundMethod.__reactBoundContext = component;
1271 boundMethod.__reactBoundMethod = method;
src/core/__tests__/ReactCompositeComponentError-test.js
+1 -1
@@ -26,7 +26,7 @@ var ReactErrorUtils = require('ReactErrorUtils');
26 describe('ReactCompositeComponent-error', function() {
27
28 it('should be passed the component and method name', function() {
29 - spyOn(ReactErrorUtils, 'guard');
29 + spyOn(ReactErrorUtils, 'guard').andCallThrough();
30 var Component = React.createClass({
31 someHandler: function() {},
32 render: function() {