xctc-utils 1.6.43 → 1.6.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,14 +67,17 @@ function sendDataFormat(data, msg) {
67
67
  else {
68
68
  sendData.data = data;
69
69
  }
70
+ return sendData;
70
71
  }
71
72
  function onloadIframe(id, url, data) {
72
73
  if (!id) {
73
- console.error("请传入iframe元素的id属性值");
74
+ console.error("onloadIframe:请传入iframe元素的id属性值");
75
+ alert("请传入iframe元素的id属性值");
74
76
  return;
75
77
  }
76
78
  if (!url) {
77
79
  console.error("请传入iframe元素的src属性值");
80
+ alert("onloadIframe:请传入iframe元素的src属性值");
78
81
  return;
79
82
  }
80
83
  var msg = "\u7236\u9875\u9762\u5411\u5B50\u9875\u9762".concat(url, "\u4F20\u9012\u53C2\u6570");
@@ -83,12 +86,16 @@ function onloadIframe(id, url, data) {
83
86
  iframe.src = url;
84
87
  if (iframe.hasOwnProperty("attachEvent")) {
85
88
  iframe.attachEvent('onload', function () {
86
- iframe.contentWindow.postMessage(sendData, iframe.src);
89
+ setTimeout(function () {
90
+ iframe.contentWindow.postMessage(sendData, iframe.src);
91
+ }, 0);
87
92
  });
88
93
  }
89
94
  else {
90
95
  iframe.onload = function () {
91
- iframe.contentWindow.postMessage(sendData, iframe.src);
96
+ setTimeout(function () {
97
+ iframe.contentWindow.postMessage(sendData, iframe.src);
98
+ }, 0);
92
99
  };
93
100
  }
94
101
  }
@@ -105,8 +112,8 @@ var parentSendIframeData = function (id, data, url, duration) {
105
112
  console.error("请传入iframe元素的id属性值");
106
113
  return;
107
114
  }
108
- if (!(0, is_1.isObject)(data)) {
109
- console.error("请传递到子页面参数只能是对象");
115
+ if (!data) {
116
+ console.error("请传入需要发送到子页面数据");
110
117
  return;
111
118
  }
112
119
  if (!duration)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.43",
3
+ "version": "1.6.45",
4
4
  "description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",