Skip to content

Commit

Permalink
make fields private and add to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Aug 28, 2024
1 parent f0da561 commit 66f50e5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 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,18 +166,18 @@ class USBWorkflow extends Workflow {
btnRequestSerialDevice.removeEventListener('click', serialConnect);
btnRequestSerialDevice.addEventListener('click', serialConnect);

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


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

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

0 comments on commit 66f50e5

Please sign in to comment.