blob: 97d96e7fb71a9d41271923ec831940b91ab94ccf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
'use strict';
// Dedicated worker
if (typeof postMessage === 'function') {
onmessage = event => {
switch(event.data.type) {
case 'ready':
navigator.usb.getDevices().then(
() => postMessage({ type: 'availability-result', enabled: true }),
error => postMessage ({ type: 'availability-result', enabled: false }));
break;
}
};
}
|