引入依赖
const mp = requireModule("mpaas_jsapi");postNotification
发送通知。
mp.postNotification(
{
name:'TEST_EVENT',
data: {
hello: 'hello world'
}
},
res=>{
}
);addNotifyListener
注册通知。
didAppear() {
mp.addNotifyListener(
{
name: 'TEST_EVENT'
},
res => {
this.clientToCube(res)
}
)
},removeNotifyListener
移除通知。
didDisappear() {
mp.removeNotifyListener(
{
name: 'TEST_EVENT'
},
res => {
console.info(JSON.stringify(res))
}
)
},说明
客户端做了校验,调用 MPCube.recycleCard 后会自动释放通知监听。
该文章对您有帮助吗?