完成
This commit is contained in:
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user