Comparing version 0.0.11 to 0.0.12
@@ -41,3 +41,3 @@ (function (global, factory) { | ||
isAndroid: ['android'].includes(deviceType), | ||
isiOs: ['ios'].includes(deviceType), | ||
isIOS: ['ios'].includes(deviceType), | ||
isH5: ['h5'].includes(deviceType), | ||
@@ -111,2 +111,18 @@ isWechat: ['wechat'].includes(deviceType), | ||
/** | ||
* 等待微信 Jweixin 加载完毕 | ||
*/ | ||
function awaitJweixin() { | ||
return new Promise((resolve, reject) => { | ||
console.log(this); | ||
if (this._wxReady) { | ||
return resolve(true) | ||
} | ||
setTimeout(() => { | ||
console.log('=========='); | ||
return resolve(awaitJweixin()) | ||
}, 100); | ||
}) | ||
} | ||
/** | ||
* 分享 | ||
@@ -120,3 +136,3 @@ * @param {title} 分享标题 | ||
function updateAppMessageShareData(config) { | ||
const { title, desc, link, imgUrl } = { | ||
const { title, desc, link, imgUrl, autoShow } = { | ||
title: '消费保 - 您身边的消费服务管家', | ||
@@ -126,2 +142,3 @@ desc: '消费保是中国电子商会旗下的消费服务保障平台。通过免费处理投诉建立消费者与企业之间的信任。是一家依托互联网大数据技术,以消费服务分析为基础,构建从选购、售后到回收一站式消费保障服务,通过消费服务管家、企业客服SaaS系统、消费舆情监测三大系统,服务于政府、企业、消费者的平台型企业。 ', | ||
imgUrl: 'https://xfb.oss-cn-shenzhen.aliyuncs.com/2023-05/logo.jpg', | ||
autoShow: false, | ||
...(config || {}), | ||
@@ -146,2 +163,5 @@ }; | ||
imgUrl, | ||
success: () => { | ||
autoShow && updateAppMessageShareDataSuccess(); | ||
}, | ||
}); | ||
@@ -153,2 +173,5 @@ this._wx.updateTimelineShareData({ | ||
imgUrl, | ||
success: () => { | ||
autoShow && updateAppMessageShareDataSuccess(); | ||
}, | ||
}); | ||
@@ -160,7 +183,6 @@ } | ||
*/ | ||
function showShareDrive() { | ||
function updateAppMessageShareDataSuccess() { | ||
console.log('【XFB-SDK】Jweixin 更新分享数据成功'); | ||
console.log(document.getElementsByClassName('overlay-xfbsdk')); | ||
// 清空所有的遮罩层 | ||
Array.from(document.getElementsByClassName('overlay-xfbsdk')).forEach(item => { | ||
@@ -191,4 +213,5 @@ item.remove(); | ||
initJweixin, | ||
awaitJweixin, | ||
updateAppMessageShareData, | ||
showShareDrive, | ||
updateAppMessageShareDataSuccess, | ||
_wx: null, | ||
@@ -195,0 +218,0 @@ _wxReady: false, |
{ | ||
"name": "xfb-sdk", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"author": "wangfei", | ||
@@ -5,0 +5,0 @@ "description": "", |
6830
195