1
0
forked from dyf/APP

添加全局消息监听

This commit is contained in:
liub
2025-08-18 08:38:28 +08:00
parent e95b2466e1
commit 535f4728ea
2 changed files with 29 additions and 8 deletions

View File

@ -128,8 +128,8 @@ class BleHelper {
}
//设置发现新设备的回调
addDeviceFound(callback) {
let key = this.getCurrentPagePath();
addDeviceFound(callback,currKey) {
let key =currKey?currKey:this.getCurrentPagePath();
if (!key) {
key = new Date().getTime();
}
@ -150,8 +150,8 @@ class BleHelper {
}
//移除发现新设备的回调
removeDeviceFound() {
let key = this.getCurrentPagePath();
removeDeviceFound(currKey) {
let key =currKey?currKey: this.getCurrentPagePath();
if (key) {
console.log("key=" + key);
@ -170,8 +170,8 @@ class BleHelper {
}
//添加接收到数据的回调
addReceiveCallback(callback) {
let key = this.getCurrentPagePath();
addReceiveCallback(callback,currKey) {
let key =currKey?currKey: this.getCurrentPagePath();
if (!key) {
key = new Date().getTime();
}
@ -193,8 +193,8 @@ class BleHelper {
//设置接收到数据的回调
removeReceiveCallback(ev) {
let key = this.getCurrentPagePath();
removeReceiveCallback(ev,currKey) {
let key =currKey?currKey: this.getCurrentPagePath();
if (key) {
console.log("key=" + key);
let f = this.cfg.receivDataCallback.findIndex((v) => {