forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontributions.ts
34 lines (29 loc) · 1.26 KB
/
contributions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import H from 'history'
import React from 'react'
import { Subscription } from 'rxjs'
import { ExtensionsControllerProps } from '../../shared/src/extensions/controller'
import { registerHighlightContributions } from '../../shared/src/highlight/contributions'
import { registerHoverContributions } from '../../shared/src/hover/actions'
import { PlatformContextProps } from '../../shared/src/platform/context'
import { registerSearchStatsContributions } from './enterprise/search/stats/contributions'
interface Props extends ExtensionsControllerProps, PlatformContextProps {
history: H.History
}
/**
* A component that registers global contributions. It is implemented as a React component so that its
* registrations use the React lifecycle.
*/
export class GlobalContributions extends React.Component<Props> {
private subscriptions = new Subscription()
public componentDidMount(): void {
registerHighlightContributions() // no way to unregister these
this.subscriptions.add(registerHoverContributions(this.props))
this.subscriptions.add(registerSearchStatsContributions(this.props))
}
public componentWillUnmount(): void {
this.subscriptions.unsubscribe()
}
public render(): JSX.Element | null {
return null
}
}