Created
October 21, 2018 10:08
-
-
Save aybarburak/780051c8713406e5928a872d3022eafb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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