X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-utils.js;h=5bd58d7c852f08d62ee0766854030a8e298b4cbe;hb=685bae09233c9b19038965283653bc793d8bc338;hp=11a2fba2f76861806fde946af6be631083e9d8ca;hpb=870190b5b5ad4e2ee930d14ac1c5d0e2be6f8fe0;p=dygraphs.git diff --git a/dygraph-utils.js b/dygraph-utils.js index 11a2fba..5bd58d7 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -193,7 +193,7 @@ Dygraph.addEvent = function addEvent(elem, type, fn) { * on the event. The function takes one parameter: the event object. * @private */ -Dygraph.prototype.addEvent = function(elem, type, fn) { +Dygraph.prototype.addAndTrackEvent = function(elem, type, fn) { Dygraph.addEvent(elem, type, fn); this.registeredEvents_.push({ elem : elem, type : type, fn : fn }); }; @@ -221,6 +221,17 @@ Dygraph.removeEvent = function(elem, type, fn) { } }; +Dygraph.prototype.removeTrackedEvents_ = function() { + if (this.registeredEvents_) { + for (var idx = 0; idx < this.registeredEvents_.length; idx++) { + var reg = this.registeredEvents_[idx]; + Dygraph.removeEvent(reg.elem, reg.type, reg.fn); + } + } + + this.registeredEvents_ = []; +} + /** * Cancels further processing of an event. This is useful to prevent default * browser actions, e.g. highlighting text on a double-click.