uniapp-request-sdk 1.0.3 → 1.1.4

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.
package/dist/index.d.ts CHANGED
@@ -7,15 +7,15 @@ interface IParams {
7
7
  onErrorHandler?: (error: any) => void;
8
8
  /** 公共请求头 */
9
9
  header?: Record<string, string>;
10
- /** 请求尝试次数 */
10
+ /** 请求尝试次数,默认3次 */
11
11
  maxRetryCount?: number;
12
- /** 请求超时时间 */
12
+ /** 请求超时时间默认10s,ms为单位 */
13
13
  timeout?: number;
14
- /** 请求尝试延迟时间 */
14
+ /** 请求尝试延迟时间默认1s,ms为单位 */
15
15
  retryDelay?: number;
16
- /** token */
16
+ /** token,APP初始化给到小程序的token */
17
17
  token?: string;
18
- /** 向APP得到token的event事件名称,默认getToken */
18
+ /** 向APP得到token的event事件名称,默认getLoginInfo */
19
19
  tokenEventName?: string;
20
20
  }
21
21
  declare class UniRequest {
@@ -53,9 +53,9 @@
53
53
  function getToken(eventName) {
54
54
  return new Promise(function (res, rej) {
55
55
  var timeout = setTimeout(rej, 5000);
56
- uni.sendNativeEvent(eventName, {}, function (token) {
56
+ uni.sendNativeEvent(eventName, {}, function (resData) {
57
57
  clearTimeout(timeout);
58
- res(token);
58
+ res(resData === null || resData === void 0 ? void 0 : resData.token);
59
59
  });
60
60
  });
61
61
  }
@@ -73,7 +73,7 @@
73
73
  /** 超时时间 */
74
74
  this.timeout = 10000;
75
75
  this.retryDelay = 1000;
76
- this.tokenEventName = 'getToken';
76
+ this.tokenEventName = 'getLoginInfo';
77
77
  if (params) {
78
78
  Object.keys(params).forEach(function (key) {
79
79
  if (params[key] !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniapp-request-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.1.4",
4
4
  "description": "用于uniapp小程序的请求库的sdk",
5
5
  "main": "dist/index.umd.mini.js",
6
6
  "typings": "dist/index.d.ts",