The Event Handlers documentation says :
Event handlers can be bound to events using the .on method that is exposed by the plot div object. Please note: it is possible to use jQuery events, but plotly.js no longer bundles jQuery, so we recommend using the plotly.js implementation.
Will these automatically be unbound by plotly.js? If so, when? (Perhaps when .purge
is called?) If not, would the plotly.js team please consider adding a .off
method for this purpose? In lieu of a .off
method, will using element.removeEventListener('plotly_eventName', handler)
work reliably?
Update: Looks like plotly.js uses a NodeJS style EventEmitter
API, so perhaps the correct way to unbind handlers is element.removeListener('plotly_eventName', handler)
(plotly/plotly.js/blob/master/src/lib/events.js#L57). Is that right?