From: manufitoussi Date: Fri, 25 Jan 2013 13:23:54 +0000 (+0100) Subject: To avoid the rising count of useless resizes : we remove the handler if it exists... X-Git-Tag: v1.0.0~105^2~11 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=194075ffc1b1c44e37e785aed7dc92e777d7d192;p=dygraphs.git To avoid the rising count of useless resizes : we remove the handler if it exists before re-adding it. --- diff --git a/dygraph.js b/dygraph.js index ecbbca7..ae089d0 100644 --- a/dygraph.js +++ b/dygraph.js @@ -966,6 +966,12 @@ Dygraph.prototype.createInterface_ = function() { }; this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler); + + if (this.resizeHandler) { + // remove handler because it's already setup. + Dygraph.removeEvent(window, 'resize', this.resizeHandler); + } + this.resizeHandler = function(e) { dygraph.resize(); };