2.0.0 • Published 6 years ago
react-native-notification-center v2.0.0
##订阅
componentWillMount(){
this._notifyList = new Array();
this._notifyList.push(APLNotificationCenter.getInstance().subscribe('mykey', (info)=>{
console.log(info);
}));
}
componentWillUnmount(){
this._notifyList.forEach((notifyItem)=>{
APLNotificationCenter.getInstance().remove(notifyItem);
});
}
##发布
APLNotificationCenter.getInstance().publish('mykey' {
text:'发布的消息'
});