EventBus: Introduces new event bus with emitter backward compatible interface (#27564)

* updated

* Experimenting with event bus with legacy support

* Before switch to emitter

* EventBus & Emitter unification

* Everything using new EventBus

* Making progress

* Fixing merge issues

* Final merge issues

* Updated

* Updates

* Fix

* Updated

* Update

* Update

* Rename methods to publish and subscribe

* Ts fixes

* Updated

* updated

* fixing doc warnigns

* removed unused file
This commit is contained in:
Torkel Ödegaard
2020-11-03 13:08:54 +01:00
committed by GitHub
parent d84d8a134f
commit 74c65eca26
49 changed files with 556 additions and 341 deletions

View File

@@ -1,7 +1,7 @@
import $ from 'jquery';
import { appEvents } from 'app/core/core';
import { CoreEvents } from 'app/types';
import { textUtil, systemDateFormats } from '@grafana/data';
import { textUtil, systemDateFormats, LegacyGraphHoverClearEvent, LegacyGraphHoverEvent } from '@grafana/data';
export default function GraphTooltip(this: any, elem: any, dashboard: any, scope: any, getSeriesFn: any) {
const self = this;
@@ -157,7 +157,7 @@ export default function GraphTooltip(this: any, elem: any, dashboard: any, scope
plot.unhighlight();
}
}
appEvents.emit(CoreEvents.graphHoverClear);
dashboard.events.$emit(new LegacyGraphHoverClearEvent());
});
elem.bind('plothover', (event: any, pos: { panelRelY: number; pageY: number }, item: any) => {
@@ -165,7 +165,7 @@ 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(CoreEvents.graphHover, { pos: pos, panel: panel });
dashboard.events.$emit(new LegacyGraphHoverEvent({ pos: pos, panel: panel }));
});
elem.bind('plotclick', (event: any, pos: any, item: any) => {