react-proxy
Advanced tools
Comparing version
@@ -479,6 +479,15 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
for (var autoBindKey in component.__reactAutoBindMap) { | ||
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
var method = component.__reactAutoBindMap[autoBindKey]; | ||
component[autoBindKey] = bindAutoBindMethod(component, method); | ||
if (!component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
return; | ||
} | ||
// Tweak: skip methods that are already bound. | ||
// This is to preserve method reference in case it is used | ||
// as a subscription handler that needs to be detached later. | ||
if (component.hasOwnProperty(autoBindKey) && component[autoBindKey].__reactBoundContext === component) { | ||
continue; | ||
} | ||
var method = component.__reactAutoBindMap[autoBindKey]; | ||
component[autoBindKey] = bindAutoBindMethod(component, method); | ||
} | ||
@@ -779,2 +788,7 @@ } | ||
if (prototypeDescriptor.get().length !== component[name].length) { | ||
// The length doesn't match, bail out | ||
return false; | ||
} | ||
// This seems like a method bound using an autobinding getter on the prototype | ||
@@ -781,0 +795,0 @@ // Hopefully we won't run into too many false positives. |
@@ -51,6 +51,15 @@ /** | ||
for (var autoBindKey in component.__reactAutoBindMap) { | ||
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
var method = component.__reactAutoBindMap[autoBindKey]; | ||
component[autoBindKey] = bindAutoBindMethod(component, method); | ||
if (!component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
return; | ||
} | ||
// Tweak: skip methods that are already bound. | ||
// This is to preserve method reference in case it is used | ||
// as a subscription handler that needs to be detached later. | ||
if (component.hasOwnProperty(autoBindKey) && component[autoBindKey].__reactBoundContext === component) { | ||
continue; | ||
} | ||
var method = component.__reactAutoBindMap[autoBindKey]; | ||
component[autoBindKey] = bindAutoBindMethod(component, method); | ||
} | ||
@@ -57,0 +66,0 @@ } |
@@ -33,2 +33,7 @@ 'use strict'; | ||
if (prototypeDescriptor.get().length !== component[name].length) { | ||
// The length doesn't match, bail out | ||
return false; | ||
} | ||
// This seems like a method bound using an autobinding getter on the prototype | ||
@@ -35,0 +40,0 @@ // Hopefully we won't run into too many false positives. |
{ | ||
"name": "react-proxy", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "Proxies React components without unmounting or losing their state.", | ||
@@ -5,0 +5,0 @@ "main": "modules/index.js", |
@@ -52,7 +52,19 @@ /** | ||
for (var autoBindKey in component.__reactAutoBindMap) { | ||
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
var method = component.__reactAutoBindMap[autoBindKey]; | ||
component[autoBindKey] = bindAutoBindMethod(component, method); | ||
if (!component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
return; | ||
} | ||
// Tweak: skip methods that are already bound. | ||
// This is to preserve method reference in case it is used | ||
// as a subscription handler that needs to be detached later. | ||
if ( | ||
component.hasOwnProperty(autoBindKey) && | ||
component[autoBindKey].__reactBoundContext === component | ||
) { | ||
continue; | ||
} | ||
var method = component.__reactAutoBindMap[autoBindKey]; | ||
component[autoBindKey] = bindAutoBindMethod(component, method); | ||
} | ||
}; |
@@ -26,2 +26,7 @@ function shouldDeleteClassicInstanceMethod(component, name) { | ||
if (prototypeDescriptor.get().length !== component[name].length) { | ||
// The length doesn't match, bail out | ||
return false; | ||
} | ||
// This seems like a method bound using an autobinding getter on the prototype | ||
@@ -28,0 +33,0 @@ // Hopefully we won't run into too many false positives. |
75922
1.88%2101
1.74%