Skip to content

Commit

Permalink
use util function instead of dispatch event
Browse files Browse the repository at this point in the history
  • Loading branch information
penqe committed May 14, 2024
1 parent 5314d74 commit df9896c
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions stanzas/barchart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,28 +633,22 @@ function emitSelectedEventByBarChart(this: Barchart, id: any, dataUrl: string) {
ids.splice(indexInSelectedBars, 1);
}
// dispatch event
this.element.dispatchEvent(
new CustomEvent("changeSelectedNodes", {
detail: {
selectedIds: ids,
targetId: id,
dataUrl,
},
})
);
emitSelectedEvent({
rootElement: this.element,
targetId: id,
selectedIds: ids,
dataUrl,
})
changeSelectedStyle.apply(this, [ids]);
}
function emitSelectedEventByHistogram(this: Barchart, ids: any[], dataUrl: string) {
// dispatch event
this.element.dispatchEvent(
new CustomEvent("changeSelectedNodes", {
detail: {
selectedIds: ids,
targetId: ids[0],
dataUrl,
},
})
);
emitSelectedEvent({
rootElement: this.element,
targetId: ids[0],
selectedIds: ids,
dataUrl,
})
changeSelectedStyle.apply(this, [ids]);
}

Expand Down

0 comments on commit df9896c

Please sign in to comment.