@@ -1031,22 +1031,24 @@ export interface IApplicationEnvironment {
10311031 readonly uriScheme : string ;
10321032}
10331033
1034- export const IWebPanelMessageListener = Symbol ( 'IWebPanelMessageListener' ) ;
1035- export interface IWebPanelMessageListener extends IAsyncDisposable {
1034+ export interface IWebviewMessageListener {
10361035 /**
1037- * Listens to web panel messages
1036+ * Listens to webview messages
10381037 * @param message: the message being sent
10391038 * @param payload: extra data that came with the message
1040- * @return A IWebPanel that can be used to show html pages.
10411039 */
10421040 onMessage ( message : string , payload : any ) : void ;
1041+ }
1042+
1043+ export const IWebviewPanelMessageListener = Symbol ( 'IWebviewPanelMessageListener' ) ;
1044+ export interface IWebviewPanelMessageListener extends IWebviewMessageListener , IAsyncDisposable {
10431045 /**
10441046 * Listens to web panel state changes
10451047 */
1046- onChangeViewState ( panel : IWebPanel ) : void ;
1048+ onChangeViewState ( panel : IWebviewPanel ) : void ;
10471049}
10481050
1049- export type WebPanelMessage = {
1051+ export type WebviewMessage = {
10501052 /**
10511053 * Message type
10521054 */
@@ -1058,13 +1060,13 @@ export type WebPanelMessage = {
10581060 payload ?: any ;
10591061} ;
10601062
1061- // Wraps the VS Code webview panel
1062- export const IWebPanel = Symbol ( 'IWebPanel ' ) ;
1063- export interface IWebPanel {
1063+ // Wraps a VS Code webview
1064+ export const IWebview = Symbol ( 'IWebview ' ) ;
1065+ export interface IWebview {
10641066 /**
1065- * Event is fired when the load for a web panel fails
1067+ * Sends a message to the hosted html page
10661068 */
1067- readonly loadFailed : Event < void > ;
1069+ postMessage ( message : WebviewMessage ) : void ;
10681070 /**
10691071 * Convert a uri for the local file system to one that can be used inside webviews.
10701072 *
@@ -1077,6 +1079,15 @@ export interface IWebPanel {
10771079 * ```
10781080 */
10791081 asWebviewUri ( localResource : Uri ) : Uri ;
1082+ }
1083+
1084+ // Wraps the VS Code webview panel
1085+ export const IWebviewPanel = Symbol ( 'IWebviewPanel' ) ;
1086+ export interface IWebviewPanel extends IWebview {
1087+ /**
1088+ * Event is fired when the load for a web panel fails
1089+ */
1090+ readonly loadFailed : Event < void > ;
10801091 setTitle ( val : string ) : void ;
10811092 /**
10821093 * Makes the webpanel show up.
@@ -1089,11 +1100,6 @@ export interface IWebPanel {
10891100 */
10901101 isVisible ( ) : boolean ;
10911102
1092- /**
1093- * Sends a message to the hosted html page
1094- */
1095- postMessage ( message : WebPanelMessage ) : void ;
1096-
10971103 /**
10981104 * Attempts to close the panel if it's visible
10991105 */
@@ -1109,35 +1115,31 @@ export interface IWebPanel {
11091115 updateCwd ( cwd : string ) : void ;
11101116}
11111117
1112- export interface IWebPanelOptions {
1118+ export interface IWebviewOptions {
1119+ rootPath : string ;
1120+ cwd : string ;
1121+ scripts : string [ ] ;
1122+ }
1123+
1124+ export interface IWebviewPanelOptions extends IWebviewOptions {
11131125 viewColumn : ViewColumn ;
1114- listener : IWebPanelMessageListener ;
1126+ listener : IWebviewPanelMessageListener ;
11151127 title : string ;
1116- rootPath : string ;
11171128 /**
11181129 * Additional paths apart from cwd and rootPath, that webview would allow loading resources/files from.
11191130 * E.g. required for webview to serve images from worksapces when nb is in a nested folder.
11201131 */
11211132 additionalPaths ?: string [ ] ;
1122- scripts : string [ ] ;
1123- cwd : string ;
11241133 // tslint:disable-next-line: no-any
11251134 settings ?: any ;
11261135 // Web panel to use if supplied by VS code instead
11271136 webViewPanel ?: WebviewPanel ;
11281137}
11291138
11301139// Wraps the VS Code api for creating a web panel
1131- export const IWebPanelProvider = Symbol ( 'IWebPanelProvider' ) ;
1132- export interface IWebPanelProvider {
1133- /**
1134- * Creates a new webpanel
1135- *
1136- * @param {IWebPanelOptions } options - params for creating an IWebPanel
1137- * @returns {IWebPanel }
1138- * @memberof IWebPanelProvider
1139- */
1140- create ( options : IWebPanelOptions ) : Promise < IWebPanel > ;
1140+ export const IWebviewPanelProvider = Symbol ( 'IWebviewPanelProvider' ) ;
1141+ export interface IWebviewPanelProvider {
1142+ create ( options : IWebviewPanelOptions ) : Promise < IWebviewPanel > ;
11411143}
11421144
11431145// Wraps the vsls liveshare API
0 commit comments