Skip to content

Commit

Permalink
where we're going, we don't need bloat
Browse files Browse the repository at this point in the history
  • Loading branch information
jakedowns committed Feb 4, 2024
1 parent da04c39 commit c14efc0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit c14efc0

Please sign in to comment.