Jaculus-vscode-web

VS Code Web Extension demonstrating WebUSB access - testing version

Language:

TypeScript

Created:

17.07.2023

Updated:

21.07.2023

Stars:

0

Visit on GitHub

WebUSB Web Extension

VS Code Web Extension demonstrating WebUSB access

Prerequisites

A VS Code Web build available which includes https://github.com/microsoft/vscode/pull/152310

Description

WebUSB devices can be accessed from web extensions running in the web extension host webworker here:

https://github.com/thegecko/webusb-web-extension/blob/main/src/browser/commands.ts#L23

WebUSB devices need to be authorised before being accessed and this is possible due to the new workbench.experimental.requestUsbDevice command.

This is triggered from the webview here:

https://github.com/thegecko/webusb-web-extension/blob/main/src/views/webusb-view.ts#L7

but run in the webworker here:

https://github.com/thegecko/webusb-web-extension/blob/main/src/views/webusb-main.ts#L25

Screenshot

Install

npm install
npm run watch

In second terminal:

npm run browser

Then open the extension in VS Code and run the Run Extension launch configuration.