xctc-utils 1.6.70 → 1.6.72

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.
@@ -1 +1 @@
1
- export declare function autoUpdateLastVersion(): void;
1
+ export declare function autoUpdateLastVersion(duration?: number): void;
@@ -32,7 +32,7 @@ async function needUpdate() {
32
32
  autoUpdateLastSrcs = newScripts;
33
33
  return result;
34
34
  }
35
- const autoUpdateDuration = 5000;
35
+ let autoUpdateDuration = 5000;
36
36
  function autoRefresh() {
37
37
  setTimeout(async () => {
38
38
  const willUpdate = await needUpdate();
@@ -42,7 +42,10 @@ function autoRefresh() {
42
42
  autoRefresh();
43
43
  }, autoUpdateDuration);
44
44
  }
45
- function autoUpdateLastVersion() {
45
+ function autoUpdateLastVersion(duration) {
46
+ if (duration && Number(duration) >= 2000) {
47
+ autoUpdateDuration = duration;
48
+ }
46
49
  autoRefresh();
47
50
  }
48
51
  exports.autoUpdateLastVersion = autoUpdateLastVersion;
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.onlinePay = exports.shareReady = exports.configReady = exports.getCode = exports.envSDK = exports.getUrlCode = exports.initWeixinConfig = exports.loadWeiXinSDK = void 0;
27
- // import * as weixin from 'weixin-js-sdk' // 引入微信SDK
27
+ const weixin = __importStar(require("weixin-js-sdk")); // 引入微信SDK
28
28
  // const weixin = require("weixin-js-sdk")
29
29
  const utils_1 = require("../utils");
30
30
  const crypto_1 = require("../crypto");
@@ -38,7 +38,7 @@ const defaultKey = "5uMz4R8r0926DkC8";
38
38
  const defaultIv = "5uMz4R8r0926DkC8";
39
39
  var weixinConfig = {};
40
40
  let weixinUrl = "https://res.wx.qq.com/open/js/jweixin-1.6.0.js";
41
- let weixinJsSource = "";
41
+ let weixinJsSource = weixin;
42
42
  function loadWeiXinSDK(url, callback) {
43
43
  const win = window;
44
44
  if (url) {
@@ -132,9 +132,7 @@ function getUrlCode(config) {
132
132
  console.error("非微信环境下,该函数将终止执行!");
133
133
  return;
134
134
  }
135
- loadWeiXinSDK("", () => {
136
- initWeixinConfig(config);
137
- });
135
+ initWeixinConfig(config);
138
136
  }
139
137
  exports.getUrlCode = getUrlCode;
140
138
  function cryptoConfig(key, iv) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
3
  "private": false,
4
- "version": "1.6.70",
4
+ "version": "1.6.72",
5
5
  "description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -18,7 +18,8 @@
18
18
  "typescript": "^4.9.5"
19
19
  },
20
20
  "dependencies": {
21
- "crypto-js": "^4.2.0"
21
+ "crypto-js": "^4.2.0",
22
+ "weixin-js-sdk": "^1.6.5"
22
23
  },
23
24
  "repository": {
24
25
  "type": "git",