Types: Adds type safety to appEvents (#19418)

* Types: Add type safety to appEvents
This commit is contained in:
kay delaney
2019-10-14 09:27:47 +01:00
committed by GitHub
parent e7c37cc316
commit 99411bf37a
138 changed files with 991 additions and 508 deletions

View File

@@ -1,5 +1,6 @@
import $ from 'jquery';
import { appEvents } from 'app/core/core';
import { CoreEvents } from 'app/types';
export default function GraphTooltip(this: any, elem: any, dashboard: any, scope: any, getSeriesFn: any) {
const self = this;
@@ -155,7 +156,7 @@ export default function GraphTooltip(this: any, elem: any, dashboard: any, scope
plot.unhighlight();
}
}
appEvents.emit('graph-hover-clear');
appEvents.emit(CoreEvents.graphHoverClear);
});
elem.bind('plothover', (event: any, pos: { panelRelY: number; pageY: number }, item: any) => {
@@ -163,11 +164,11 @@ export default function GraphTooltip(this: any, elem: any, dashboard: any, scope
// broadcast to other graph panels that we are hovering!
pos.panelRelY = (pos.pageY - elem.offset().top) / elem.height();
appEvents.emit('graph-hover', { pos: pos, panel: panel });
appEvents.emit(CoreEvents.graphHover, { pos: pos, panel: panel });
});
elem.bind('plotclick', (event: any, pos: any, item: any) => {
appEvents.emit('graph-click', { pos: pos, panel: panel, item: item });
appEvents.emit(CoreEvents.graphClicked, { pos: pos, panel: panel, item: item });
});
this.clear = (plot: { clearCrosshair: () => void; unhighlight: () => void }) => {