Skip to content

Commit dbf85b0

Browse files
authored
Merge pull request #292 from makermelissa/ws-busy
Show busy while user selects port and handle canceling properly
2 parents 289b597 + 59761cf commit dbf85b0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

js/workflows/usb.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ class USBWorkflow extends Workflow {
125125
// This would help with other workflows as well
126126
} else {
127127
console.log('Requesting any serial device...');
128-
device = await navigator.serial.requestPort();
128+
try {
129+
device = await navigator.serial.requestPort();
130+
} catch (e) {
131+
console.log(e);
132+
return false;
133+
}
129134
}
130135

131136
// If we didn't automatically use a saved device
@@ -155,7 +160,7 @@ class USBWorkflow extends Workflow {
155160
btnSelectHostFolder.disabled = true;
156161
let serialConnect = async (event) => {
157162
try {
158-
await this.connectToSerial();
163+
await this.showBusy(this.connectToSerial());
159164
} catch (e) {
160165
//console.log(e);
161166
//alert(e.message);

0 commit comments

Comments
 (0)