where we're going, we don't need bloat

This commit is contained in:
jake downs 2024-02-03 20:33:01 -05:00
parent da04c39b6c
commit c14efc0b8b
1 changed files with 27 additions and 0 deletions

View File

@ -14,5 +14,32 @@
</head>
<body class="flex justify-center items-center h-screen text-white bg-black">
<h1 class="text-4xl font-bold text-purple-800 bg-blue-900 p-4 rounded">Hello, World!</h1>
<!-- Button to kick off a USBHID session device request -->
<button id="usbhid-button" class="mt-4 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Start USBHID Session
</button>
<script>
// Get the button element
const usbhidButton = document.getElementById('usbhid-button');
// Add event listener for the button click
usbhidButton.addEventListener('click', async () => {
// Request USB device
let device;
try {
device = await navigator.usb.requestDevice({ filters: [{ vendorId: 0x2341 }] });
} catch (err) {
console.error("No device was selected", err);
}
// If device is selected, start a session
if (device !== undefined) {
console.log("USBHID session started with device: ", device.productName);
}
});
</script>
</body>
</html>