Skip to content

Commit

Permalink
Merge pull request #242 from FoamyGuy/beta_dev
Browse files Browse the repository at this point in the history
save callback on this, and await folder functions
  • Loading branch information
makermelissa authored Aug 28, 2024
2 parents 06c7f01 + 66f50e5 commit eddc427
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions js/workflows/usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class USBWorkflow extends Workflow {
this._partialToken = null;
this._uid = null;
this._readLoopPromise = null;
this._btnSelectHostFolderCallback = null;
this._btnUseHostFolderCallback = null;

}

async init(params) {
Expand Down Expand Up @@ -163,11 +166,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 eddc427

Please sign in to comment.