Files
grafana/packages/grafana-runtime/src/services/appEvents.ts
Marcus Andersson eb9d85a2bf Deprecation: use locationService in favor of getLocationSrv (#44813)
* deprecated

* updating documentation.

* added deprecation notice.

* Replacing deprecated getLocationSrv.

* Update docs/sources/developers/plugins/migration-guide.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/developers/plugins/migration-guide.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/developers/plugins/migration-guide.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/developers/plugins/migration-guide.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* updating according to feedback.

* Update docs/sources/developers/plugins/migration-guide.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/developers/plugins/migration-guide.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2022-02-07 09:37:56 +01:00

60 lines
1.2 KiB
TypeScript

import { BusEventBase, BusEventWithPayload, EventBus, GrafanaTheme2, PanelModel, TimeRange } from '@grafana/data';
/**
* Called when a dashboard is refreshed
*
* @public
*/
export class RefreshEvent extends BusEventBase {
static type = 'refresh';
}
/**
* Called when the theme settings change
*
* @public
*/
export class ThemeChangedEvent extends BusEventWithPayload<GrafanaTheme2> {
static type = 'theme-changed';
}
/**
* Called when time range is updated
*
* @public
*/
export class TimeRangeUpdatedEvent extends BusEventWithPayload<TimeRange> {
static type = 'time-range-updated';
}
/**
* Called to copy a panel JSON into local storage
*
* @public
*/
export class CopyPanelEvent extends BusEventWithPayload<PanelModel> {
static type = 'copy-panel';
}
// Internal singleton instance
let singletonInstance: EventBus;
/**
* Used during startup by Grafana to set the setAppEvents so it is available
* via the {@link setAppEvents} to the rest of the application.
*
* @internal
*/
export function setAppEvents(instance: EventBus) {
singletonInstance = instance;
}
/**
* Used to retrieve an event bus that manages application level events
*
* @public
*/
export function getAppEvents(): EventBus {
return singletonInstance;
}