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
This commit is contained in:
parent
efdc5da097
commit
f1508c4937
|
@ -1265,9 +1265,7 @@ var ReactCompositeComponentMixin = {
|
|||
*/
|
||||
_bindAutoBindMethod: function(method) {
|
||||
var component = this;
|
||||
var boundMethod = function() {
|
||||
return method.apply(component, arguments);
|
||||
};
|
||||
var boundMethod = method.bind(component);
|
||||
if (__DEV__) {
|
||||
boundMethod.__reactBoundContext = component;
|
||||
boundMethod.__reactBoundMethod = method;
|
||||
|
|
|
@ -26,7 +26,7 @@ var ReactErrorUtils = require('ReactErrorUtils');
|
|||
describe('ReactCompositeComponent-error', function() {
|
||||
|
||||
it('should be passed the component and method name', function() {
|
||||
spyOn(ReactErrorUtils, 'guard');
|
||||
spyOn(ReactErrorUtils, 'guard').andCallThrough();
|
||||
var Component = React.createClass({
|
||||
someHandler: function() {},
|
||||
render: function() {
|
||||
|
|
Loading…
Reference in New Issue