https://github.com/laike9m/webview-test
Test VS Code extension that uses webview
https://github.com/laike9m/webview-test
Last synced: 3 months ago
JSON representation
Test VS Code extension that uses webview
- Host: GitHub
- URL: https://github.com/laike9m/webview-test
- Owner: laike9m
- Created: 2020-09-20T01:06:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-20T01:10:15.000Z (over 4 years ago)
- Last Synced: 2024-10-29T23:34:04.382Z (8 months ago)
- Language: TypeScript
- Size: 18.8 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cat Coding — A Webview API Sample
Demonstrates VS Code's [webview API](https://code.visualstudio.com/api/extension-guides/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.
- Using a basic content security policy.
- Webview lifecycle and handling dispose.
- Saving and restoring state when the panel goes into the background.
- Serialization and persistence across VS Code reboots.## Demo

## VS Code API
### `vscode` module
- [`window.createWebviewPanel`](https://code.visualstudio.com/api/references/vscode-api#window.createWebviewPanel)
- [`window.registerWebviewPanelSerializer`](https://code.visualstudio.com/api/references/vscode-api#window.registerWebviewPanelSerializer)## Running the example
- Open this example in VS Code 1.47+
- `npm install`
- `npm run watch` or `npm run compile`
- `F5` to start debuggingRun the `Cat Coding: Start cat coding session` to create the webview.