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