2018-04-24 15:07:32 -07:00
|
|
|
# Cat Coding — A Webview API Sample
|
|
|
|
|
|
2018-12-16 21:08:20 -08:00
|
|
|
Demonstrates VS Code's [webview API](https://code.visualstudio.com/api/extension-guides/webview). This includes:
|
2018-04-24 15:07:32 -07:00
|
|
|
|
|
|
|
|
- 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
|
|
|
|
2018-10-17 12:19:44 -07:00
|
|
|
## Demo
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
## VS Code API
|
|
|
|
|
|
|
|
|
|
### `vscode` module
|
|
|
|
|
|
2018-12-16 21:08:20 -08:00
|
|
|
- [`window.createWebviewPanel`](https://code.visualstudio.com/api/references/vscode-api#window.createWebviewPanel)
|
|
|
|
|
- [`window.registerWebviewPanelSerializer`](https://code.visualstudio.com/api/references/vscode-api#window.registerWebviewPanelSerializer)
|
2018-10-17 12:19:44 -07:00
|
|
|
|
2018-04-24 15:07:32 -07:00
|
|
|
## Running the example
|
|
|
|
|
|
2020-08-06 13:55:57 -07:00
|
|
|
- Open this example in VS Code 1.47+
|
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.
|