Skip to content

Commit

Permalink
save callback on this, and await folder functions
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Aug 28, 2024
1 parent 06c7f01 commit f0da561
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions js/workflows/usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,18 @@ class USBWorkflow extends Workflow {
btnRequestSerialDevice.removeEventListener('click', serialConnect);
btnRequestSerialDevice.addEventListener('click', serialConnect);

btnSelectHostFolder.removeEventListener('click', this._selectHostFolder);
btnSelectHostFolder.addEventListener('click', this._selectHostFolder);
btnSelectHostFolder.removeEventListener('click', this.btnSelectHostFolderCallback)
this.btnSelectHostFolderCallback = async (event) => {
await this._selectHostFolder();
};
btnSelectHostFolder.addEventListener('click', this.btnSelectHostFolderCallback);


btnUseHostFolder.removeEventListener('click', this._useHostFolder);
btnUseHostFolder.addEventListener('click', this._useHostFolder);
btnUseHostFolder.removeEventListener('click', this.btnUseHostFolderCallback);
this.btnUseHostFolderCallback = async (event) => {
await this._useHostFolder();
}
btnUseHostFolder.addEventListener('click', this.btnUseHostFolderCallback);

// Check if WebSerial is available
if (!(await this.available() instanceof Error)) {
Expand Down

0 comments on commit f0da561

Please sign in to comment.