监听识别

This commit is contained in:
iqudoo
2026-06-09 12:36:34 +08:00
parent 0b1b145b9c
commit d574f08faf
4 changed files with 40 additions and 9 deletions

7
types/index.d.ts vendored
View File

@@ -274,6 +274,10 @@ interface ScanListenerInfo {
* 监听级别
*/
level?: number;
/**
* 为 true 时仅接收同 key 主动扫码startScan/scanImage 等)的结果,忽略扫码枪
*/
selfKeyOnly?: boolean;
/**
* 监听回调
*/
@@ -333,8 +337,9 @@ interface IScan {
* @param key 监听key
* @param match 监听匹配
* @param level 监听级别
* @param selfKeyOnly 为 true 时仅接收同 key 主动扫码结果,忽略扫码枪
*/
onScanListener(callback: ScanResultCallback, key: string, match?: string, level?: number): ScanListenerInfo;
onScanListener(callback: ScanResultCallback, key: string, match?: string, level?: number, selfKeyOnly?: boolean): ScanListenerInfo;
/**
* 取消监听扫码结果
* @param callback 监听回调或监听key