@tarojs/taro 3.3.13 → 3.3.14

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.
Files changed (97) hide show
  1. package/package.json +5 -5
  2. package/types/api/ad/index.d.ts +34 -28
  3. package/types/api/alipay/index.d.ts +11 -7
  4. package/types/api/base/debug.d.ts +60 -54
  5. package/types/api/base/env.d.ts +12 -8
  6. package/types/api/base/index.d.ts +87 -83
  7. package/types/api/base/system.d.ts +59 -54
  8. package/types/api/base/update.d.ts +37 -33
  9. package/types/api/base/weapp/app-event.d.ts +147 -131
  10. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  11. package/types/api/canvas/index.d.ts +115 -110
  12. package/types/api/cloud/index.d.ts +99 -94
  13. package/types/api/data-analysis/index.d.ts +68 -64
  14. package/types/api/device/accelerometer.d.ts +57 -50
  15. package/types/api/device/battery.d.ts +19 -15
  16. package/types/api/device/ble.d.ts +241 -228
  17. package/types/api/device/bluetooth.d.ts +207 -194
  18. package/types/api/device/clipboard.d.ts +48 -43
  19. package/types/api/device/compass.d.ts +55 -48
  20. package/types/api/device/contact.d.ts +13 -9
  21. package/types/api/device/gyroscope.d.ts +41 -35
  22. package/types/api/device/iBeacon.d.ts +79 -73
  23. package/types/api/device/motion.d.ts +42 -37
  24. package/types/api/device/network.d.ts +48 -42
  25. package/types/api/device/nfc.d.ts +105 -96
  26. package/types/api/device/performance.d.ts +22 -18
  27. package/types/api/device/phone.d.ts +20 -15
  28. package/types/api/device/scan.d.ts +31 -26
  29. package/types/api/device/screen.d.ts +74 -67
  30. package/types/api/device/vibrate.d.ts +31 -25
  31. package/types/api/device/wifi.d.ts +151 -140
  32. package/types/api/ext/index.d.ts +44 -39
  33. package/types/api/files/index.d.ts +219 -209
  34. package/types/api/framework/index.d.ts +25 -20
  35. package/types/api/location/index.d.ts +140 -136
  36. package/types/api/media/audio.d.ts +135 -127
  37. package/types/api/media/background-audio.d.ts +135 -126
  38. package/types/api/media/camera.d.ts +30 -26
  39. package/types/api/media/editor.d.ts +35 -33
  40. package/types/api/media/image.d.ts +161 -150
  41. package/types/api/media/live.d.ts +88 -82
  42. package/types/api/media/map.d.ts +47 -43
  43. package/types/api/media/recorder.d.ts +90 -84
  44. package/types/api/media/video-processing.d.ts +10 -6
  45. package/types/api/media/video.d.ts +63 -58
  46. package/types/api/network/download.d.ts +34 -30
  47. package/types/api/network/mdns.d.ts +104 -91
  48. package/types/api/network/request.d.ts +83 -79
  49. package/types/api/network/udp.d.ts +20 -16
  50. package/types/api/network/upload.d.ts +60 -56
  51. package/types/api/network/websocket.d.ts +201 -194
  52. package/types/api/open-api/account.d.ts +18 -14
  53. package/types/api/open-api/address.d.ts +27 -23
  54. package/types/api/open-api/authorize.d.ts +30 -26
  55. package/types/api/open-api/card.d.ts +55 -51
  56. package/types/api/open-api/customer-service.d.ts +21 -17
  57. package/types/api/open-api/facial.d.ts +28 -24
  58. package/types/api/open-api/invoice.d.ts +38 -34
  59. package/types/api/open-api/login.d.ts +56 -52
  60. package/types/api/open-api/navigate.d.ts +79 -75
  61. package/types/api/open-api/payment.d.ts +34 -30
  62. package/types/api/open-api/settings.d.ts +49 -45
  63. package/types/api/open-api/soter.d.ts +92 -86
  64. package/types/api/open-api/subscribe-message.d.ts +24 -20
  65. package/types/api/open-api/user-info.d.ts +60 -57
  66. package/types/api/open-api/werun.d.ts +50 -46
  67. package/types/api/route/index.d.ts +122 -118
  68. package/types/api/share/index.d.ts +68 -64
  69. package/types/api/storage/background-fetch.d.ts +40 -35
  70. package/types/api/storage/index.d.ts +267 -262
  71. package/types/api/swan/index.d.ts +47 -42
  72. package/types/api/ui/animation.d.ts +21 -17
  73. package/types/api/ui/background.d.ts +38 -34
  74. package/types/api/ui/custom-component.d.ts +22 -18
  75. package/types/api/ui/fonts.d.ts +26 -21
  76. package/types/api/ui/interaction.d.ts +153 -149
  77. package/types/api/ui/keyboard.d.ts +59 -55
  78. package/types/api/ui/menu.d.ts +10 -6
  79. package/types/api/ui/navigation-bar.d.ts +67 -63
  80. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  81. package/types/api/ui/scroll.d.ts +30 -26
  82. package/types/api/ui/sticky.d.ts +22 -19
  83. package/types/api/ui/tab-bar.d.ts +101 -97
  84. package/types/api/ui/window.d.ts +24 -18
  85. package/types/api/worker/index.d.ts +28 -24
  86. package/types/api/wxml/index.d.ts +42 -38
  87. package/types/global.d.ts +350 -0
  88. package/types/index.d.ts +12 -98
  89. package/types/taro.api.d.ts +94 -0
  90. package/types/taro.component.d.ts +10 -57
  91. package/types/taro.config.d.ts +24 -6
  92. package/types/taro.extend.d.ts +70 -67
  93. package/types/taro.hooks.d.ts +68 -67
  94. package/types/taro.lifecycle.d.ts +47 -28
  95. package/types/api/ad/index.ts +0 -6
  96. package/types/api/alipay/index.ts +0 -7
  97. package/types/api/index.d.ts +0 -352
@@ -1,16 +1,18 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace login {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
6
8
  /** 接口调用失败的回调函数 */
7
- fail?: (res: General.CallbackResult) => void
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用成功的回调函数 */
9
11
  success?: (result: SuccessCallbackResult) => void
10
12
  /** 超时时间,单位ms */
11
13
  timeout?: number
12
14
  }
13
- interface SuccessCallbackResult extends General.CallbackResult {
15
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
14
16
  /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */
15
17
  code: string
16
18
  /** 调用结果 */
@@ -18,60 +20,62 @@ declare namespace Taro {
18
20
  }
19
21
  }
20
22
 
21
- /** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
22
- * @supported weapp
23
- * @example
24
- * ```tsx
25
- * Taro.login({
26
- * success: function (res) {
27
- * if (res.code) {
28
- * //发起网络请求
29
- * Taro.request({
30
- * url: 'https://test.com/onLogin',
31
- * data: {
32
- * code: res.code
33
- * }
34
- * })
35
- * } else {
36
- * console.log('登录失败!' + res.errMsg)
37
- * }
38
- * }
39
- * })
40
- * ```
41
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html
42
- */
43
- function login(option?: login.Option): Promise<login.SuccessCallbackResult>
44
-
45
23
  namespace checkSession {
46
24
  interface Option {
47
25
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
48
- complete?: (res: General.CallbackResult) => void
26
+ complete?: (res: TaroGeneral.CallbackResult) => void
49
27
  /** 接口调用失败的回调函数 */
50
- fail?: (res: General.CallbackResult) => void
28
+ fail?: (res: TaroGeneral.CallbackResult) => void
51
29
  /** 接口调用成功的回调函数 */
52
- success?: (res: General.CallbackResult) => void
30
+ success?: (res: TaroGeneral.CallbackResult) => void
53
31
  }
54
32
  }
55
33
 
56
- /** 检查登录态是否过期。
57
- *
58
- * 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
59
- *
60
- * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
61
- * @supported weapp
62
- * @example
63
- * ```tsx
64
- * Taro.checkSession({
65
- * success: function () {
66
- * //session_key 未过期,并且在本生命周期一直有效
67
- * },
68
- * fail: function () {
69
- * // session_key 已经失效,需要重新执行登录流程
70
- * Taro.login() //重新登录
71
- * }
72
- * })
73
- * ```
74
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html
75
- */
76
- function checkSession(option?: checkSession.Option): Promise<General.CallbackResult>
34
+ interface TaroStatic {
35
+ /** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
36
+ * @supported weapp
37
+ * @example
38
+ * ```tsx
39
+ * Taro.login({
40
+ * success: function (res) {
41
+ * if (res.code) {
42
+ * //发起网络请求
43
+ * Taro.request({
44
+ * url: 'https://test.com/onLogin',
45
+ * data: {
46
+ * code: res.code
47
+ * }
48
+ * })
49
+ * } else {
50
+ * console.log('登录失败!' + res.errMsg)
51
+ * }
52
+ * }
53
+ * })
54
+ * ```
55
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html
56
+ */
57
+ login(option?: login.Option): Promise<login.SuccessCallbackResult>
58
+
59
+ /** 检查登录态是否过期。
60
+ *
61
+ * 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
62
+ *
63
+ * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
64
+ * @supported weapp
65
+ * @example
66
+ * ```tsx
67
+ * Taro.checkSession({
68
+ * success: function () {
69
+ * //session_key 未过期,并且在本生命周期一直有效
70
+ * },
71
+ * fail: function () {
72
+ * // session_key 已经失效,需要重新执行登录流程
73
+ * Taro.login() //重新登录
74
+ * }
75
+ * })
76
+ * ```
77
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html
78
+ */
79
+ checkSession(option?: checkSession.Option): Promise<TaroGeneral.CallbackResult>
80
+ }
77
81
  }
@@ -1,44 +1,33 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace exitMiniProgram {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
6
8
  /** 接口调用失败的回调函数 */
7
- fail?: (res: General.CallbackResult) => void
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用成功的回调函数 */
9
- success?: (res: General.CallbackResult) => void
11
+ success?: (res: TaroGeneral.CallbackResult) => void
10
12
  }
11
13
  }
12
14
 
13
- /**
14
- * 退出当前小程序。必须有点击行为才能调用成功。
15
- * 基础库 2.17.3 开始支持
16
- * @supported weapp
17
- * @example
18
- * ```tsx
19
- * Taro.exitMiniProgram()
20
- * ···
21
- *
22
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html
23
- */
24
- function exitMiniProgram(option?: exitMiniProgram.Option): Promise<General.CallbackResult>
25
-
26
15
  namespace navigateToMiniProgram {
27
16
  interface Option {
28
17
  /** 要打开的小程序 appId */
29
18
  appId: string
30
19
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
31
- complete?: (res: General.CallbackResult) => void
20
+ complete?: (res: TaroGeneral.CallbackResult) => void
32
21
  /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。*/
33
22
  envVersion?: keyof envVersion
34
23
  /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
35
- extraData?: General.IAnyObject
24
+ extraData?: TaroGeneral.IAnyObject
36
25
  /** 接口调用失败的回调函数 */
37
- fail?: (res: General.CallbackResult) => void
26
+ fail?: (res: TaroGeneral.CallbackResult) => void
38
27
  /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
39
28
  path?: string
40
29
  /** 接口调用成功的回调函数 */
41
- success?: (res: General.CallbackResult) => void
30
+ success?: (res: TaroGeneral.CallbackResult) => void
42
31
  }
43
32
 
44
33
  interface envVersion {
@@ -51,67 +40,82 @@ declare namespace Taro {
51
40
  }
52
41
  }
53
42
 
54
- /** 打开另一个小程序
55
- *
56
- * **使用限制**
57
- * ##### 需要用户触发跳转
58
- * 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
59
- * ##### 需要用户确认跳转
60
- * 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
61
- * ##### 每个小程序可跳转的其他小程序数量限制为不超过 10 个
62
- * 从 2.4.0 版本以及指定日期(具体待定)开始,开发者提交新版小程序代码时,如使用了跳转其他小程序功能,则需要在代码配置中声明将要跳转的小程序名单,限定不超过 10 个,否则将无法通过审核。该名单可在发布新版时更新,不支持动态修改。配置方法详见 [小程序全局配置](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html)。调用此接口时,所跳转的 appId 必须在配置列表中,否则回调 `fail appId "${appId}" is not in navigateToMiniProgramAppIdList`。
63
- *
64
- * **关于调试**
65
- * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
66
- * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
67
- * @supported weapp
68
- * @example
69
- * ```tsx
70
- * Taro.navigateToMiniProgram({
71
- * appId: '',
72
- * path: 'page/index/index?id=123',
73
- * extraData: {
74
- * foo: 'bar'
75
- * },
76
- * envVersion: 'develop',
77
- * success: function(res) {
78
- * // 打开成功
79
- * }
80
- * })
81
- * ```
82
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html
83
- */
84
- function navigateToMiniProgram(option: navigateToMiniProgram.Option): Promise<General.CallbackResult>
85
-
86
43
  namespace navigateBackMiniProgram {
87
44
  interface Option {
88
45
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
89
- complete?: (res: General.CallbackResult) => void
46
+ complete?: (res: TaroGeneral.CallbackResult) => void
90
47
  /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html)。 */
91
- extraData?: General.IAnyObject
48
+ extraData?: TaroGeneral.IAnyObject
92
49
  /** 接口调用失败的回调函数 */
93
- fail?: (res: General.CallbackResult) => void
50
+ fail?: (res: TaroGeneral.CallbackResult) => void
94
51
  /** 接口调用成功的回调函数 */
95
- success?: (res: General.CallbackResult) => void
52
+ success?: (res: TaroGeneral.CallbackResult) => void
96
53
  }
97
54
  }
98
55
 
99
- /** 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
100
- *
101
- * 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
102
- * @supported weapp
103
- * @example
104
- * ```tsx
105
- * Taro.navigateBackMiniProgram({
106
- * extraData: {
107
- * foo: 'bar'
108
- * },
109
- * success: function (res) {
110
- * // 返回成功
111
- * }
112
- * })
113
- * ```
114
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html
115
- */
116
- function navigateBackMiniProgram(option: navigateBackMiniProgram.Option): Promise<General.CallbackResult>
56
+ interface TaroStatic {
57
+ /**
58
+ * 退出当前小程序。必须有点击行为才能调用成功。
59
+ * 基础库 2.17.3 开始支持
60
+ * @supported weapp
61
+ * @example
62
+ * ```tsx
63
+ * Taro.exitMiniProgram()
64
+ * ···
65
+ *
66
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html
67
+ */
68
+ exitMiniProgram(option?: exitMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
69
+
70
+ /** 打开另一个小程序
71
+ *
72
+ * **使用限制**
73
+ * ##### 需要用户触发跳转
74
+ * 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
75
+ * ##### 需要用户确认跳转
76
+ * 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
77
+ * ##### 每个小程序可跳转的其他小程序数量限制为不超过 10 个
78
+ * 从 2.4.0 版本以及指定日期(具体待定)开始,开发者提交新版小程序代码时,如使用了跳转其他小程序功能,则需要在代码配置中声明将要跳转的小程序名单,限定不超过 10 个,否则将无法通过审核。该名单可在发布新版时更新,不支持动态修改。配置方法详见 [小程序全局配置](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html)。调用此接口时,所跳转的 appId 必须在配置列表中,否则回调 `fail appId "${appId}" is not in navigateToMiniProgramAppIdList`。
79
+ *
80
+ * **关于调试**
81
+ * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
82
+ * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
83
+ * @supported weapp
84
+ * @example
85
+ * ```tsx
86
+ * Taro.navigateToMiniProgram({
87
+ * appId: '',
88
+ * path: 'page/index/index?id=123',
89
+ * extraData: {
90
+ * foo: 'bar'
91
+ * },
92
+ * envVersion: 'develop',
93
+ * success: function(res) {
94
+ * // 打开成功
95
+ * }
96
+ * })
97
+ * ```
98
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html
99
+ */
100
+ navigateToMiniProgram(option: navigateToMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
101
+
102
+ /** 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
103
+ *
104
+ * 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
105
+ * @supported weapp
106
+ * @example
107
+ * ```tsx
108
+ * Taro.navigateBackMiniProgram({
109
+ * extraData: {
110
+ * foo: 'bar'
111
+ * },
112
+ * success: function (res) {
113
+ * // 返回成功
114
+ * }
115
+ * })
116
+ * ```
117
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html
118
+ */
119
+ navigateBackMiniProgram(option: navigateBackMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
120
+ }
117
121
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace requestPayment {
3
5
  interface Option {
4
6
  /** 随机字符串,长度为32个字符以下 */
@@ -10,13 +12,13 @@ declare namespace Taro {
10
12
  /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
11
13
  timeStamp: string
12
14
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
13
- complete?: (res: General.CallbackResult) => void
15
+ complete?: (res: TaroGeneral.CallbackResult) => void
14
16
  /** 接口调用失败的回调函数 */
15
- fail?: (res: General.CallbackResult) => void
17
+ fail?: (res: TaroGeneral.CallbackResult) => void
16
18
  /** 签名算法 */
17
19
  signType?: keyof signType
18
20
  /** 接口调用成功的回调函数 */
19
- success?: (res: General.CallbackResult) => void
21
+ success?: (res: TaroGeneral.CallbackResult) => void
20
22
  }
21
23
 
22
24
  interface signType {
@@ -27,31 +29,33 @@ declare namespace Taro {
27
29
  }
28
30
  }
29
31
 
30
- /** 发起微信支付。了解更多信息,请查看[微信支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
31
- * @supported weapp, h5
32
- * @example
33
- * ```tsx
34
- * Taro.requestPayment({
35
- * timeStamp: '',
36
- * nonceStr: '',
37
- * package: '',
38
- * signType: 'MD5',
39
- * paySign: '',
40
- * success: function (res) { },
41
- * fail: function (res) { }
42
- * })
43
- * ```
44
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html
45
- */
46
- function requestPayment(option: requestPayment.Option): Promise<General.CallbackResult>
32
+ interface TaroStatic {
33
+ /** 发起微信支付。了解更多信息,请查看[微信支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
34
+ * @supported weapp, h5
35
+ * @example
36
+ * ```tsx
37
+ * Taro.requestPayment({
38
+ * timeStamp: '',
39
+ * nonceStr: '',
40
+ * package: '',
41
+ * signType: 'MD5',
42
+ * paySign: '',
43
+ * success: function (res) { },
44
+ * fail: function (res) { }
45
+ * })
46
+ * ```
47
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html
48
+ */
49
+ requestPayment(option: requestPayment.Option): Promise<TaroGeneral.CallbackResult>
47
50
 
48
- /** 支付各个安全场景验证人脸
49
- * @supported weapp
50
- * @example
51
- * ```tsx
52
- * Taro.faceVerifyForPay(params).then(...)
53
- * ```
54
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.faceVerifyForPay.html
55
- */
56
- function faceVerifyForPay(option: any): Promise<any>
51
+ /** 支付各个安全场景验证人脸
52
+ * @supported weapp
53
+ * @example
54
+ * ```tsx
55
+ * Taro.faceVerifyForPay(params).then(...)
56
+ * ```
57
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.faceVerifyForPay.html
58
+ */
59
+ faceVerifyForPay(option: any): Promise<any>
60
+ }
57
61
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace openSetting {
3
5
  interface Option {
4
6
  /**
@@ -7,14 +9,14 @@ declare namespace Taro {
7
9
  */
8
10
  withSubscriptions?: boolean
9
11
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
10
- complete?: (res: General.CallbackResult) => void
12
+ complete?: (res: TaroGeneral.CallbackResult) => void
11
13
  /** 接口调用失败的回调函数 */
12
- fail?: (res: General.CallbackResult) => void
14
+ fail?: (res: TaroGeneral.CallbackResult) => void
13
15
  /** 接口调用成功的回调函数 */
14
16
  success?: (result: SuccessCallbackResult) => void
15
17
  }
16
18
 
17
- interface SuccessCallbackResult extends General.CallbackResult {
19
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
18
20
  /** 用户授权结果 */
19
21
  authSetting: AuthSetting
20
22
  /** 调用结果 */
@@ -22,37 +24,17 @@ declare namespace Taro {
22
24
  }
23
25
  }
24
26
 
25
- /** 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
26
- *
27
- * 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
28
- * @supported weapp
29
- * @example
30
- * ```tsx
31
- * Taro.openSetting({
32
- * success: function (res) {
33
- * console.log(res.authSetting)
34
- * // res.authSetting = {
35
- * // "scope.userInfo": true,
36
- * // "scope.userLocation": true
37
- * // }
38
- * }
39
- * })
40
- * ```
41
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html
42
- */
43
- function openSetting(option?: openSetting.Option): Promise<openSetting.SuccessCallbackResult>
44
-
45
27
  namespace getSetting {
46
28
  interface Option {
47
29
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
48
- complete?: (res: General.CallbackResult) => void
30
+ complete?: (res: TaroGeneral.CallbackResult) => void
49
31
  /** 接口调用失败的回调函数 */
50
- fail?: (res: General.CallbackResult) => void
32
+ fail?: (res: TaroGeneral.CallbackResult) => void
51
33
  /** 接口调用成功的回调函数 */
52
34
  success?: (result: SuccessCallbackResult) => void
53
35
  }
54
36
 
55
- interface SuccessCallbackResult extends General.CallbackResult {
37
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
56
38
  /** 用户授权结果 */
57
39
  authSetting: AuthSetting
58
40
  /** 调用结果 */
@@ -60,24 +42,6 @@ declare namespace Taro {
60
42
  }
61
43
  }
62
44
 
63
- /** 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
64
- * @supported weapp
65
- * @example
66
- * ```tsx
67
- * Taro.getSetting({
68
- * success: function (res) {
69
- * console.log(res.authSetting)
70
- * // res.authSetting = {
71
- * // "scope.userInfo": true,
72
- * // "scope.userLocation": true
73
- * // }
74
- * }
75
- * })
76
- * ```
77
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html
78
- */
79
- function getSetting(option?: getSetting.Option): Promise<getSetting.SuccessCallbackResult>
80
-
81
45
  /** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)
82
46
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html
83
47
  */
@@ -101,4 +65,44 @@ declare namespace Taro {
101
65
  /** 是否授权保存到相册 [wx.saveImageToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html), [wx.saveVideoToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) */
102
66
  'scope.writePhotosAlbum'?: boolean
103
67
  }
68
+
69
+ interface TaroStatic {
70
+ /** 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
71
+ *
72
+ * 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
73
+ * @supported weapp
74
+ * @example
75
+ * ```tsx
76
+ * Taro.openSetting({
77
+ * success: function (res) {
78
+ * console.log(res.authSetting)
79
+ * // res.authSetting = {
80
+ * // "scope.userInfo": true,
81
+ * // "scope.userLocation": true
82
+ * // }
83
+ * }
84
+ * })
85
+ * ```
86
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html
87
+ */
88
+ openSetting(option?: openSetting.Option): Promise<openSetting.SuccessCallbackResult>
89
+
90
+ /** 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
91
+ * @supported weapp
92
+ * @example
93
+ * ```tsx
94
+ * Taro.getSetting({
95
+ * success: function (res) {
96
+ * console.log(res.authSetting)
97
+ * // res.authSetting = {
98
+ * // "scope.userInfo": true,
99
+ * // "scope.userLocation": true
100
+ * // }
101
+ * }
102
+ * })
103
+ * ```
104
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html
105
+ */
106
+ getSetting(option?: getSetting.Option): Promise<getSetting.SuccessCallbackResult>
107
+ }
104
108
  }