增加 window 对象检查, 并保证每次都返回正确的 wx 对象, 避免重复引用时返回 undefined

This commit is contained in:
yanxi 2023-10-17 22:21:17 +08:00
parent 0d38e1dcca
commit a895af9f99

View File

@ -1,6 +1,10 @@
!(function (e, n) {
module.exports = n(e);
})(window, function (r, e) {
})(typeof window === "object" && window, function (r, e) {
if (!r) {
console.warn("can't use weixin-js-sdk in server side");
return {};
}
var a, c, n, i, t, o, s, d, l, u, p, f, m, g, h, S, y, I, v, _, w, T;
if (!r.jWeixin)
return (
@ -722,6 +726,7 @@
e && (r.wx = r.jWeixin = _),
_
);
else return r.jWeixin;
function k(n, e, i) {
r.WeixinJSBridge
? WeixinJSBridge.invoke(n, P(e), function (e) {