All these issues report that event listeners would not be removed properly causing issues in resizing, or when switching to a different view in SPAs
The boundDrawFn was necessarily complicated, we need not attach it to a 'global' variable BOUND_DRAW_FN, it can be made available to this
the unbindWindowEvents function (which unbinds all window events) is not a good naming choice for an API (It is renamed to destroy making this a breaking change)
Solving the following issues: https://github.com/frappe/charts/issues/168, https://github.com/frappe/charts/issues/210, https://github.com/frappe/charts/issues/200, https://github.com/frappe/charts/issues/168
boundDrawFn
was necessarily complicated, we need not attach it to a 'global' variableBOUND_DRAW_FN
, it can be made available tothis
unbindWindowEvents
function (which unbinds allwindow
events) is not a good naming choice for an API (It is renamed todestroy
making this a breaking change)This PR fixes all of that.