in src/webview.ts [183:210]
async deserializeWebviewPanel(webviewPanel: vscode.WebviewPanel, state: any) {
// `state` is the state persisted using `setState` inside the webview
console.log(`Got state: ${state}`);
// Restore the content of our webview.
//
// Make sure we hold on to the `webviewPanel` passed in here and
// also restore any event listeners we need on it.
// webviewPanel.webview.html = getWebviewContent();
webviewPanel.webview.html = htmlTemplate(
{
getUri: (assetUri) =>
webviewPanel.webview.asWebviewUri(
vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, assetUri),
),
cspSource: webviewPanel.webview.cspSource,
},
state,
);
webviewPanel.webview.onDidReceiveMessage((message) => {
if (message.type && message.requestId) {
alicloudAPIMessageService.exectService(message).then((result) => {
webviewPanel.webview.postMessage(result);
});
}
});
}