mirror of
https://github.com/yanxi-me/weixin-js-sdk.git
synced 2025-04-06 04:00:07 +08:00
增加 window 对象检查, 并保证每次都返回正确的 wx 对象, 避免重复引用时返回 undefined
This commit is contained in:
parent
0d38e1dcca
commit
a895af9f99
7
index.js
7
index.js
@ -1,6 +1,10 @@
|
|||||||
!(function (e, n) {
|
!(function (e, n) {
|
||||||
module.exports = n(e);
|
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;
|
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)
|
if (!r.jWeixin)
|
||||||
return (
|
return (
|
||||||
@ -722,6 +726,7 @@
|
|||||||
e && (r.wx = r.jWeixin = _),
|
e && (r.wx = r.jWeixin = _),
|
||||||
_
|
_
|
||||||
);
|
);
|
||||||
|
else return r.jWeixin;
|
||||||
function k(n, e, i) {
|
function k(n, e, i) {
|
||||||
r.WeixinJSBridge
|
r.WeixinJSBridge
|
||||||
? WeixinJSBridge.invoke(n, P(e), function (e) {
|
? WeixinJSBridge.invoke(n, P(e), function (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user