Files
vscode-extension-samples/webview-sample/README.md

35 lines
1.1 KiB
Markdown
Raw Normal View History

2018-04-24 15:07:32 -07:00
# Cat Coding — A Webview API Sample
Demonstrates VS Code's [webview API](https://code.visualstudio.com/docs/extensions/webview). This includes:
- Creating and showing a basic webview.
- Dynamically updating a webview's content.
- Loading local content in a webview.
- Running scripts in a webview.
- Sending message from an extension to a webview.
- Sending messages from a webview to an extension.
2018-04-24 15:29:16 -07:00
- Using a basic content security policy.
- Webview lifecycle and handling dispose.
2018-07-18 18:56:40 -07:00
- Saving and restoring state when the panel goes into the background.
- Serialization and persistence across VS Code reboots.
2018-04-24 15:07:32 -07:00
## Demo
![demo](demo.gif)
## VS Code API
### `vscode` module
- [`window.createWebviewPanel`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#window.createWebviewPanel)
- [`window.registerWebviewPanelSerializer`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#window.registerWebviewPanelSerializer)
2018-04-24 15:07:32 -07:00
## Running the example
2018-07-18 18:56:40 -07:00
- Open this example in VS Code 1.25+
2018-04-24 15:07:32 -07:00
- `npm install`
2018-04-25 11:25:10 -07:00
- `npm run watch` or `npm run compile`
2018-04-24 15:07:32 -07:00
- `F5` to start debugging
Run the `Cat Coding: Start cat coding session` to create the webview.