blob: 59bb6787ddf7166217f9f60cc58752d4f2853971 (
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.serial.getPorts().then(
() => postMessage({ type: 'availability-result', enabled: true }),
error => postMessage ({ type: 'availability-result', enabled: false }));
break;
}
};
}
|