From 77309e49b4ffa0b538328b74e355cecb5545f5ec Mon Sep 17 00:00:00 2001 From: qiang Date: Thu, 23 Jul 2020 14:29:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DApp=E7=AB=AFibeacon?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BA=8B=E4=BB=B6=E5=9B=9E=E8=B0=83=E4=B8=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98=20question/102136?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app-plus/service/api/device/ibeacon.js | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/platforms/app-plus/service/api/device/ibeacon.js b/src/platforms/app-plus/service/api/device/ibeacon.js index 4dad2ccafd..c8bca9d415 100644 --- a/src/platforms/app-plus/service/api/device/ibeacon.js +++ b/src/platforms/app-plus/service/api/device/ibeacon.js @@ -1,30 +1,15 @@ import { invoke, - publish } from '../../bridge' -let beaconUpdateState = false - -export function onBeaconUpdate () { - if (!beaconUpdateState) { - plus.ibeacon.onBeaconUpdate(function (data) { - publish('onBeaconUpdated', data) - }) - beaconUpdateState = true - } +export function onBeaconUpdate (callbackId) { + plus.ibeacon.onBeaconUpdate(data => invoke(callbackId, data)) } -let beaconServiceChangeState = false - -export function onBeaconServiceChange () { - if (!beaconServiceChangeState) { - plus.ibeacon.onBeaconServiceChange(function (data) { - publish('onBeaconServiceChange', data) - publish('onBeaconServiceChanged', data) - }) - beaconServiceChangeState = true - } +export function onBeaconServiceChange (callbackId) { + plus.ibeacon.onBeaconServiceChange(data => invoke(callbackId, data)) } +export const onBeaconServiceChanged = onBeaconServiceChange export function getBeacons (params, callbackId) { plus.ibeacon.getBeacons({ -- GitLab