aboutsummaryrefslogtreecommitdiff
path: root/ui/src/common/plugins.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/common/plugins.ts')
-rw-r--r--ui/src/common/plugins.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/src/common/plugins.ts b/ui/src/common/plugins.ts
index aa414bc74..5898c5f4b 100644
--- a/ui/src/common/plugins.ts
+++ b/ui/src/common/plugins.ts
@@ -27,12 +27,14 @@ import {
TrackProvider,
} from './plugin_api';
import {Registry} from './registry';
+import {Selection} from './state';
// Every plugin gets its own PluginContext. This is how we keep track
// what each plugin is doing and how we can blame issues on particular
// plugins.
export class PluginContextImpl implements PluginContext {
readonly pluginId: string;
+ onDetailsPanelSelectionChange?: (newSelection?: Selection) => void;
private trackProviders: TrackProvider[];
constructor(pluginId: string) {
@@ -53,6 +55,11 @@ export class PluginContextImpl implements PluginContext {
registerTrackProvider(provider: TrackProvider) {
this.trackProviders.push(provider);
}
+
+ registerOnDetailsPanelSelectionChange(
+ onDetailsPanelSelectionChange: (newSelection?: Selection) => void) {
+ this.onDetailsPanelSelectionChange = onDetailsPanelSelectionChange;
+ }
// ==================================================================
// ==================================================================
@@ -123,6 +130,14 @@ export class PluginManager {
}
return promises;
}
+
+ onDetailsPanelSelectionChange(pluginId: string, newSelection?: Selection) {
+ const pluginContext = this.getPluginContext(pluginId);
+ if (pluginContext === undefined) return;
+ if (pluginContext.onDetailsPanelSelectionChange) {
+ pluginContext.onDetailsPanelSelectionChange(newSelection);
+ }
+ }
}
// TODO(hjd): Sort out the story for global singletons like these: