UNPKG

@grafana/runtime

Version:
1 lines 1.85 kB
{"version":3,"file":"appEvents.mjs","sources":["../../../src/services/appEvents.ts"],"sourcesContent":["import { BusEventBase, BusEventWithPayload, EventBus, GrafanaTheme2, PanelModel, TimeRange } from '@grafana/data';\n\n/**\n * Called when a dashboard is refreshed\n *\n * @public\n */\nexport class RefreshEvent extends BusEventBase {\n static type = 'refresh';\n}\n\n/**\n * Called when the theme settings change\n *\n * @public\n */\nexport class ThemeChangedEvent extends BusEventWithPayload<GrafanaTheme2> {\n static type = 'theme-changed';\n}\n\n/**\n * Called when time range is updated\n *\n * @public\n */\nexport class TimeRangeUpdatedEvent extends BusEventWithPayload<TimeRange> {\n static type = 'time-range-updated';\n}\n\n/**\n * Called to copy a panel JSON into local storage\n *\n * @public\n */\nexport class CopyPanelEvent extends BusEventWithPayload<PanelModel> {\n static type = 'copy-panel';\n}\n\n// Internal singleton instance\nlet singletonInstance: EventBus;\n\n/**\n * Used during startup by Grafana to set the setAppEvents so it is available\n * via the {@link setAppEvents} to the rest of the application.\n *\n * @internal\n */\nexport function setAppEvents(instance: EventBus) {\n singletonInstance = instance;\n}\n\n/**\n * Used to retrieve an event bus that manages application level events\n *\n * @public\n */\nexport function getAppEvents(): EventBus {\n return singletonInstance;\n}\n"],"names":[],"mappings":";;;AAOO,MAAM,qBAAqB,YAAA,CAAa;AAE/C;AAFa,YAAA,CACJ,IAAA,GAAO,SAAA;AAQT,MAAM,0BAA0B,mBAAA,CAAmC;AAE1E;AAFa,iBAAA,CACJ,IAAA,GAAO,eAAA;AAQT,MAAM,8BAA8B,mBAAA,CAA+B;AAE1E;AAFa,qBAAA,CACJ,IAAA,GAAO,oBAAA;AAQT,MAAM,uBAAuB,mBAAA,CAAgC;AAEpE;AAFa,cAAA,CACJ,IAAA,GAAO,YAAA;AAIhB,IAAI,iBAAA;AAQG,SAAS,aAAa,QAAA,EAAoB;AAC/C,EAAA,iBAAA,GAAoB,QAAA;AACtB;AAOO,SAAS,YAAA,GAAyB;AACvC,EAAA,OAAO,iBAAA;AACT;;;;"}