Skip to content

Instantly share code, notes, and snippets.

@aybarburak
Created October 21, 2018 10:08
Show Gist options
  • Save aybarburak/780051c8713406e5928a872d3022eafb to your computer and use it in GitHub Desktop.
Save aybarburak/780051c8713406e5928a872d3022eafb to your computer and use it in GitHub Desktop.
let button = document.getElementById('request-device');
button.addEventListener('click', async () => {
let device;
let usbDeviceProperties = { name: "Bixolon", vendorId: 5380, productId: 31 };
try {
device = await navigator.usb.requestDevice({ filters: usbDeviceProperties });
} catch (error) {
alert('Error: ' + error.message);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment