fix: init local device handlers even when connected to Socket Server

This commit is contained in:
yczpf2019
2026-01-24 18:37:54 +08:00
parent 8b59808c17
commit c7d57d39a1

View File

@@ -1,20 +1,20 @@
goog.loadJs('web', () => {
goog.require('path');
goog.require('Mixly.Config');
goog.require('Mixly.Env');
goog.require('Mixly.Msg');
goog.require('Mixly.Registry');
goog.require('Mixly.Serial');
goog.require('Mixly.LayerExt');
goog.require('Mixly.HTMLTemplate');
goog.require('Mixly.Web.SerialPort');
goog.require('Mixly.Web.USB');
goog.require('Mixly.Web.USBMini');
goog.require('Mixly.Web.HID');
goog.provide('Mixly.Web.Serial');
goog.require('path');
goog.require('Mixly.Config');
goog.require('Mixly.Env');
goog.require('Mixly.Msg');
goog.require('Mixly.Registry');
goog.require('Mixly.Serial');
goog.require('Mixly.LayerExt');
goog.require('Mixly.HTMLTemplate');
goog.require('Mixly.Web.SerialPort');
goog.require('Mixly.Web.USB');
goog.require('Mixly.Web.USBMini');
goog.require('Mixly.Web.HID');
goog.provide('Mixly.Web.Serial');
const {
const {
Config,
Env,
Msg,
@@ -23,22 +23,22 @@ const {
LayerExt,
HTMLTemplate,
Web
} = Mixly;
} = Mixly;
const {
const {
SerialPort,
USB,
USBMini,
HID
} = Web;
} = Web;
const { BOARD } = Config;
const { BOARD } = Config;
const platform = goog.platform();
const fullPlatform = goog.fullPlatform();
const platform = goog.platform();
const fullPlatform = goog.fullPlatform();
class WebSerial extends Serial {
class WebSerial extends Serial {
static {
this.devicesRegistry = new Registry();
this.type = Serial.type;
@@ -147,12 +147,12 @@ class WebSerial extends Serial {
handler.removePort(device);
}
this.addEventsListener = function () {}
this.addEventsListener = function () { }
this.init = function () {
if (Env.hasSocketServer) {
return;
}
// if (Env.hasSocketServer) {
// return;
// }
if (platform === 'win32' && fullPlatform !== 'win10') {
if (BOARD?.web?.devices?.hid) {
this.devicesRegistry.register('hid', HID);
@@ -207,9 +207,9 @@ class WebSerial extends Serial {
}
return new handler(port);
}
}
}
Web.Serial = WebSerial;
Web.Serial = WebSerial;
});