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

Removing unecessary resize listener

monitorScrollValue is only called with `ViewportMetrics.refreshScrollValues` (https://github.com/facebook/react/blob/master/src/browser/ReactBrowserEventEmitter.js#L333-L334) and the window scroll properties (scrollTop and scrollLeft) don't change on resize (from my testings), so there is no need to listen for window resizes. I also tried to see why the resize listener was added from the history but it was introduced on the initial commits. I created a simple page that shows that http://jsbin.com/nuhice, open the console.

Fabio M. Costa committed Nov 12, 2014 at 00:08 UTC f6dd6ef772b04db76c4823cf48c688a64c3862b9
1 file changed -1
src/browser/ui/ReactEventListener.js
-1
@@ -157,7 +157,6 @@ var ReactEventListener = {
157 monitorScrollValue: function(refresh) {
158 var callback = scrollValueMonitor.bind(null, refresh);
159 EventListener.listen(window, 'scroll', callback);
160 - EventListener.listen(window, 'resize', callback);
160 },
161
162 dispatchEvent: function(topLevelType, nativeEvent) {