import { MessageConnection } from 'sourcegraph/module/jsonrpc2/connection'; import { UpdateExtensionSettingsArgs } from './context'; /** One side of a page/client connection. */ export declare type Source = 'Page' | 'Client'; /** A connection to the client. */ export interface ClientConnection { /** Listens for the latest client settings. */ onSettings: (callback: (settings: string) => void) => void; /** Requests the client to update a setting. */ editSetting: (edit: UpdateExtensionSettingsArgs) => Promise; /** Asks the client for its settings. */ getSettings: () => Promise; /** The underlying JSON RPC connection. */ rawConnection: MessageConnection; } /** A connection to the page. */ export interface PageConnection { /** Listens for requests to edit settings. */ onEditSetting: (callback: (edit: UpdateExtensionSettingsArgs) => Promise) => void; /** Listens for requests for the latest settings. */ onGetSettings: (callback: () => Promise) => void; /** Notifies the page that the settings have been updated. */ sendSettings: (settings: string) => void; /** The underlying JSON RPC connection. */ rawConnection: MessageConnection; } /** * Connects the client (such as a browser extension) to a Sourcegraph extension registry page. */ export declare function connectAsClient(): Promise; /** * Connects the Sourcegraph extension registry page to a client (such as a browser extension). */ export declare function connectAsPage(): Promise;