mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-01-19 13:52:49 +08:00
upadte js event 'jpush.receiveNotification'
This commit is contained in:
parent
27c4fe7b26
commit
a197975d03
31
README.md
31
README.md
@ -507,8 +507,39 @@ iOS
|
|||||||
#####返回值
|
#####返回值
|
||||||
无
|
无
|
||||||
|
|
||||||
|
#### event - jpush.receiveNotification
|
||||||
|
|
||||||
|
当iOS收到的通知时会触发这个事件
|
||||||
|
|
||||||
|
##### 事件定义
|
||||||
|
|
||||||
|
cordova.fireDocumentEvent('jpush.receiveNotification',json)
|
||||||
|
|
||||||
|
#####平台
|
||||||
|
iOS
|
||||||
|
|
||||||
|
#####使用说明
|
||||||
|
|
||||||
|
- 在你需要接收通知的的js文件中加入:
|
||||||
|
|
||||||
|
document.addEventListener("jpush.openNotification", onOpenNotification, false);
|
||||||
|
|
||||||
|
- onOpenNotification需要这样写:
|
||||||
|
|
||||||
|
var onOpenNotification = function(event){
|
||||||
|
try{
|
||||||
|
var alert = event.alert;
|
||||||
|
var extras = event.extras;
|
||||||
|
console.log(alert);
|
||||||
|
//console.log(extras);
|
||||||
|
}
|
||||||
|
catch(exeption){
|
||||||
|
console.log(exception)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#####返回值
|
||||||
|
无
|
||||||
|
|
||||||
|
|
||||||
#### API - init
|
#### API - init
|
||||||
|
Loading…
Reference in New Issue
Block a user