Skip to content

Commit

Permalink
处理设置getLaunchInfo和click的返回数据的兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
黄黎 committed Oct 23, 2018
1 parent e082c78 commit 89feee9
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion www/xgpush.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@ function XGPush() {
};

this.getLaunchInfo = function (successCallback) {
exec(successCallback, null, "XGPush", "getLaunchInfo", []);
exec(function(event){
if(event.customContent&&typeof event.customContent ==="string"){
try {
var objs=JSON.parse(event.customContent);
event.customContent=objs;
event.customContent=Object.assign(...objs);
} catch (error) {

}
}
successCallback(event);
}, null, "XGPush", "getLaunchInfo", []);
};

this.getToken = function (successCallback) {
Expand All @@ -76,6 +87,16 @@ function XGPush() {
function (event) {
console.log("[XGPush] Event = " + event.type + ": ", event);
if (event && (event.type in me.channels)) {
//格式化自定义数据集
if(event.customContent&&typeof event.customContent ==="string"){
try {
var objs=JSON.parse(event.customContent);
event.customContent=objs;
event.customContent=Object.assign(...objs);
} catch (error) {

}
}
me.channels[event.type].fire(event);
}
},
Expand Down

0 comments on commit 89feee9

Please sign in to comment.