# registerReceiverEvent
事件注册-跨技术(weex/bt)。 注册事件,注册成功后会持续监听eventName,当调用sendBroadcast后,会触发receiver。注:weex使用方式和bt一致,并能交互通知。
# 输入
继承标准对象输入,扩展属性描述
| 名称 | 数据类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| eventName | string | 是 | 事件名称 | |
| receiver | string | 是 | 事件回调名称-如:receiver值为callback,那么将触发window.callback() |
# 输出
继承标准对象输出,无扩展属性
# 示例代码
app.broadcast.registerReceiverEvent(() => {
app.hint('监听成功')
}, () => {
app.hint('监听失败')
}, 'buiSendEvent', 'buigetEvnet')
// 真正触发的事件
window.buigetEvnet = (res) => {
bui.alert(res)
}
← run sendBroadcast →