You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
735 B

5 years ago
//app客户端Id
var plusClientId = '';
// 扩展API加载完毕,现在可以正常调用扩展API
document.addEventListener("plusready", function() {
//记录是否成功获取客户端id
var clientIdFlag = false;
//获取次数
var getClientIdCount = 1;
//循环获取客户端标识
if(!clientIdFlag) {
// 获取客户端标识信息
var info = plus.push.getClientInfo();
//赋值
plusClientId = info.clientid;
//如果获取客户端id成功,改变标识
if(plusClientId != '') {
clientIdFlag = true;
}
//循环一次后自增
getClientIdCount++;
//获取次数超过10次,抛出异常
// if(getClientIdCount > 10) {
// throw new Error("获取客户端Id失败!");
// }
}
}, false);