Fix: 修复平板下报错instanceof未定义
This commit is contained in:
@@ -670,9 +670,9 @@ BU.uploadWithAmpy = (portName) => {
|
|||||||
const editor = mainWorkspace.getEditorsManager().getActive();
|
const editor = mainWorkspace.getEditorsManager().getActive();
|
||||||
const port = Serial.getPort(portName);
|
const port = Serial.getPort(portName);
|
||||||
let useBuffer = true, dataLength = 256;
|
let useBuffer = true, dataLength = 256;
|
||||||
if (port instanceof window.USBDevice) {
|
if (port.constructor.name === 'USBDevice') {
|
||||||
dataLength = 64;
|
dataLength = 64;
|
||||||
} else if (port instanceof window.HIDDevice) {
|
} else if (port.constructor.name === 'HIDDevice') {
|
||||||
dataLength = 31;
|
dataLength = 31;
|
||||||
}
|
}
|
||||||
const layerNum = layer.open({
|
const layerNum = layer.open({
|
||||||
|
|||||||
@@ -113,11 +113,11 @@ class WebSerial extends Serial {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.getHandler = function (device) {
|
this.getHandler = function (device) {
|
||||||
if (device instanceof window.SerialPort) {
|
if (device.constructor.name === 'SerialPort') {
|
||||||
return SerialPort;
|
return SerialPort;
|
||||||
} else if (device instanceof window.HIDDevice) {
|
} else if (device.constructor.name === 'HIDDevice') {
|
||||||
return HID;
|
return HID;
|
||||||
} else if (device instanceof window.USBDevice) {
|
} else if (device.constructor.name === 'USBDevice') {
|
||||||
if (this.devicesRegistry.hasKey('usbmini')) {
|
if (this.devicesRegistry.hasKey('usbmini')) {
|
||||||
return USBMini;
|
return USBMini;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user