From 581688668eb46c8e9f08d4e405f06522cc136b12 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Tue, 24 Sep 2024 21:25:08 +0200 Subject: [PATCH] remove waitforconnection --- src/js/data_storage.js | 3 +++ src/js/protocols/websocket.js | 13 ------------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/js/data_storage.js b/src/js/data_storage.js index 38b391d387f..d968620da78 100644 --- a/src/js/data_storage.js +++ b/src/js/data_storage.js @@ -1,3 +1,5 @@ +import bluetooth from "./protocols/bluetooth"; + export const API_VERSION_1_39 = '1.39.0'; export const API_VERSION_1_44 = '1.44.0'; export const API_VERSION_1_45 = '1.45.0'; @@ -11,6 +13,7 @@ const CONFIGURATOR = { connectionValid: false, connectionValidCliOnly: false, + bluetoothMode: false, manualMode: false, virtualMode: false, virtualApiVersion: '0.0.1', diff --git a/src/js/protocols/websocket.js b/src/js/protocols/websocket.js index 418eda0a153..761b30a3ea9 100644 --- a/src/js/protocols/websocket.js +++ b/src/js/protocols/websocket.js @@ -57,17 +57,6 @@ class WebsocketSerial extends EventTarget { return new Uint8Array(buffer); } - waitForConnection(socket) { - return new Promise((resolve) => { - const interval = setInterval(() => { - if (socket.connected) { - clearInterval(interval); // Stop checking - resolve(); // Resolve the promise - } - }, 100); // Check every 100ms, adjust as needed - }); - } - async connect(path, options) { this.address = path; console.log(`${this.logHead} Connecting to ${this.address}`); @@ -85,8 +74,6 @@ class WebsocketSerial extends EventTarget { ); }; - await this.waitForConnection(socket); - this.ws.onclose = function(e) { console.log(`${socket.logHead} Connection closed: `, e);