[vislib/tilemap] ensure listeners are cleaned up

With the new "rendered" event, the listener added in the handler was not being cleaned up. This changes it to use the handler's `binder`, which will cleanup the listener when `handler.destroy()` is called.
This commit is contained in:
spalger 2016-09-22 11:32:49 -07:00
parent d1e56d789c
commit 66e4dbbc66

View file

@ -103,7 +103,7 @@ export default function HandlerBaseClass(Private) {
*/
render() {
const self = this;
const charts = this.charts = [];
const { binder, charts = [] } = this;
const selection = d3.select(this.el);
selection.selectAll('*').remove();
@ -125,7 +125,7 @@ export default function HandlerBaseClass(Private) {
self.enable(event, chart);
});
chart.events.on('rendered', () => {
binder.on(chart.events, 'rendered', () => {
loadedCount++;
if (loadedCount === chartSelection.length) {
// events from all charts are propagated to vis, we only need to fire renderComplete on one (first)