This commit is contained in:
iqudoo
2026-04-30 17:40:45 +08:00
parent 3c74ae7f20
commit 8eef0c1867
2 changed files with 8 additions and 8 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -4,6 +4,7 @@ import { isSupportWxScan, startScanForWx } from "../wx";
import { startScanner, stopScanner } from "../scanner";
import { getConfig } from "../config";
import { toAny } from "../../utils/toany";
import { printDebug } from "../../utils/logger";
let _scan_status = "ready";
let _scan_status_listener = null;
@@ -330,20 +331,16 @@ export function startScan() {
});
let scanPromise = Promise.resolve();
if (inRuntime()) {
console.log("startScanForBridge");
scanPromise = __startBridgeScan();
} else if (isSupportWxScan()) {
console.log("startScanForWx");
scanPromise = __startWxScan();
} else if (isSupportWebScan()) {
console.log("startScanForWeb");
unlockScanBeep();
scanPromise = startScanForWeb(getConfig("webScanCanvasStyle"), __result);
} else if (isSupportImageScan()) {
console.log("startScanForImage");
scanPromise = __startImageScan();
} else {
console.log("Not support scanner");
printDebug("Not support scanner");
}
return Promise.race([scanPromise, scannerPromise]);
}).finally(() => {
@@ -354,7 +351,7 @@ export function startScan() {
export function scanVideo() {
if (!isSupportWebScan()) {
console.log("Not support video scanner");
printDebug("Not support video scanner");
return;
}
if (isScanning() || _scan_closing || Date.now() < _scan_next_start_time) {
@@ -376,7 +373,10 @@ export function scanVideo() {
export function scanImage() {
if (!isSupportImageScan()) {
console.log("Not support image scanner");
printDebug("Not support image scanner");
return;
}
if (isScanning() || _scan_closing || Date.now() < _scan_next_start_time) {
return;
}
Promise.resolve().then(() => {