@tarojs/taro 3.3.10 → 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 (100) hide show
  1. package/html5.css +5 -5
  2. package/package.json +5 -5
  3. package/types/api/ad/index.d.ts +34 -28
  4. package/types/api/alipay/index.d.ts +11 -7
  5. package/types/api/base/debug.d.ts +60 -54
  6. package/types/api/base/env.d.ts +12 -8
  7. package/types/api/base/index.d.ts +87 -83
  8. package/types/api/base/system.d.ts +59 -54
  9. package/types/api/base/update.d.ts +37 -33
  10. package/types/api/base/weapp/app-event.d.ts +147 -131
  11. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  12. package/types/api/canvas/index.d.ts +115 -110
  13. package/types/api/cloud/index.d.ts +99 -94
  14. package/types/api/data-analysis/index.d.ts +72 -0
  15. package/types/api/device/accelerometer.d.ts +57 -50
  16. package/types/api/device/battery.d.ts +19 -15
  17. package/types/api/device/ble.d.ts +241 -228
  18. package/types/api/device/bluetooth.d.ts +207 -194
  19. package/types/api/device/clipboard.d.ts +48 -43
  20. package/types/api/device/compass.d.ts +55 -48
  21. package/types/api/device/contact.d.ts +13 -9
  22. package/types/api/device/gyroscope.d.ts +41 -35
  23. package/types/api/device/iBeacon.d.ts +79 -73
  24. package/types/api/device/motion.d.ts +42 -37
  25. package/types/api/device/network.d.ts +48 -42
  26. package/types/api/device/nfc.d.ts +105 -96
  27. package/types/api/device/performance.d.ts +22 -18
  28. package/types/api/device/phone.d.ts +20 -15
  29. package/types/api/device/scan.d.ts +31 -26
  30. package/types/api/device/screen.d.ts +74 -67
  31. package/types/api/device/vibrate.d.ts +31 -25
  32. package/types/api/device/wifi.d.ts +151 -140
  33. package/types/api/ext/index.d.ts +44 -39
  34. package/types/api/files/index.d.ts +219 -209
  35. package/types/api/framework/index.d.ts +25 -20
  36. package/types/api/location/index.d.ts +140 -136
  37. package/types/api/media/audio.d.ts +139 -127
  38. package/types/api/media/background-audio.d.ts +135 -126
  39. package/types/api/media/camera.d.ts +30 -26
  40. package/types/api/media/editor.d.ts +35 -33
  41. package/types/api/media/image.d.ts +190 -137
  42. package/types/api/media/live.d.ts +88 -82
  43. package/types/api/media/map.d.ts +47 -43
  44. package/types/api/media/recorder.d.ts +90 -84
  45. package/types/api/media/video-processing.d.ts +10 -6
  46. package/types/api/media/video.d.ts +63 -58
  47. package/types/api/network/download.d.ts +34 -30
  48. package/types/api/network/mdns.d.ts +104 -91
  49. package/types/api/network/request.d.ts +83 -79
  50. package/types/api/network/udp.d.ts +20 -16
  51. package/types/api/network/upload.d.ts +60 -56
  52. package/types/api/network/websocket.d.ts +201 -194
  53. package/types/api/open-api/account.d.ts +18 -14
  54. package/types/api/open-api/address.d.ts +27 -23
  55. package/types/api/open-api/authorize.d.ts +30 -26
  56. package/types/api/open-api/card.d.ts +55 -51
  57. package/types/api/open-api/customer-service.d.ts +45 -0
  58. package/types/api/open-api/facial.d.ts +28 -24
  59. package/types/api/open-api/invoice.d.ts +38 -34
  60. package/types/api/open-api/login.d.ts +56 -52
  61. package/types/api/open-api/navigate.d.ts +79 -75
  62. package/types/api/open-api/payment.d.ts +34 -30
  63. package/types/api/open-api/settings.d.ts +54 -45
  64. package/types/api/open-api/soter.d.ts +92 -86
  65. package/types/api/open-api/subscribe-message.d.ts +24 -20
  66. package/types/api/open-api/user-info.d.ts +60 -57
  67. package/types/api/open-api/werun.d.ts +50 -46
  68. package/types/api/route/index.d.ts +122 -118
  69. package/types/api/share/index.d.ts +68 -64
  70. package/types/api/storage/background-fetch.d.ts +40 -35
  71. package/types/api/storage/index.d.ts +267 -262
  72. package/types/api/swan/index.d.ts +47 -42
  73. package/types/api/ui/animation.d.ts +21 -17
  74. package/types/api/ui/background.d.ts +38 -34
  75. package/types/api/ui/custom-component.d.ts +22 -18
  76. package/types/api/ui/fonts.d.ts +26 -21
  77. package/types/api/ui/interaction.d.ts +167 -121
  78. package/types/api/ui/keyboard.d.ts +59 -55
  79. package/types/api/ui/menu.d.ts +10 -6
  80. package/types/api/ui/navigation-bar.d.ts +67 -63
  81. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  82. package/types/api/ui/scroll.d.ts +30 -26
  83. package/types/api/ui/sticky.d.ts +22 -19
  84. package/types/api/ui/tab-bar.d.ts +101 -97
  85. package/types/api/ui/window.d.ts +24 -18
  86. package/types/api/worker/index.d.ts +28 -24
  87. package/types/api/wxml/index.d.ts +42 -38
  88. package/types/global.d.ts +350 -0
  89. package/types/index.d.ts +14 -99
  90. package/types/taro.api.d.ts +94 -0
  91. package/types/taro.component.d.ts +10 -57
  92. package/types/taro.config.d.ts +24 -6
  93. package/types/taro.extend.d.ts +70 -67
  94. package/types/taro.hooks.d.ts +68 -67
  95. package/types/taro.lifecycle.d.ts +47 -28
  96. package/types/api/ad/index.ts +0 -6
  97. package/types/api/alipay/index.ts +0 -7
  98. package/types/api/index.d.ts +0 -352
  99. package/types/api/open-api/data-analysis.d.ts +0 -19
  100. package/types/api/open-api/report.d.ts +0 -19
@@ -1,169 +1,73 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace switchTab {
3
5
  interface Option {
4
6
  /** 需要跳转的 tabBar 页面的路径(需在 app.json 的 [tabBar](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabbar) 字段定义的页面),路径后不能带参数。 */
5
7
  url: string
6
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?: (res: General.CallbackResult) => void
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用失败的回调函数 */
9
- fail?: (res: General.CallbackResult) => void
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
12
  /** 接口调用成功的回调函数 */
11
- success?: (res: General.CallbackResult) => void
13
+ success?: (res: TaroGeneral.CallbackResult) => void
12
14
  }
13
15
  }
14
16
 
15
- /** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
16
- * @supported weapp, h5, rn
17
- * @example
18
- * ```json
19
- * {
20
- * "tabBar": {
21
- * "list": [{
22
- * "pagePath": "index",
23
- * "text": "首页"
24
- * },{
25
- * "pagePath": "other",
26
- * "text": "其他"
27
- * }]
28
- * }
29
- * }
30
- * ```
31
- *
32
- * ```tsx
33
- * Taro.switchTab({
34
- * url: '/index'
35
- * })
36
- * ```
37
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html
38
- */
39
- function switchTab(option: switchTab.Option): Promise<General.CallbackResult>
40
-
41
17
  namespace reLaunch {
42
18
  interface Option {
43
19
  /** 需要跳转的应用内页面路径,路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */
44
20
  url: string
45
21
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
46
- complete?: (res: General.CallbackResult) => void
22
+ complete?: (res: TaroGeneral.CallbackResult) => void
47
23
  /** 接口调用失败的回调函数 */
48
- fail?: (res: General.CallbackResult) => void
24
+ fail?: (res: TaroGeneral.CallbackResult) => void
49
25
  /** 接口调用成功的回调函数 */
50
- success?: (res: General.CallbackResult) => void
26
+ success?: (res: TaroGeneral.CallbackResult) => void
51
27
  }
52
28
  }
53
29
 
54
- /** 关闭所有页面,打开到应用内的某个页面
55
- * @supported weapp, h5, rn
56
- * @example
57
- * ```tsx
58
- * Taro.reLaunch({
59
- * url: 'test?id=1'
60
- * })
61
- * ```
62
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html
63
- */
64
- function reLaunch(option: reLaunch.Option): Promise<General.CallbackResult>
65
-
66
30
  namespace redirectTo {
67
31
  interface Option {
68
32
  /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
69
33
  url: string
70
34
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
71
- complete?: (res: General.CallbackResult) => void
35
+ complete?: (res: TaroGeneral.CallbackResult) => void
72
36
  /** 接口调用失败的回调函数 */
73
- fail?: (res: General.CallbackResult) => void
37
+ fail?: (res: TaroGeneral.CallbackResult) => void
74
38
  /** 接口调用成功的回调函数 */
75
- success?: (res: General.CallbackResult) => void
39
+ success?: (res: TaroGeneral.CallbackResult) => void
76
40
  }
77
41
  }
78
42
 
79
- /** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
80
- * @supported weapp, h5, rn
81
- * @example
82
- * ```tsx
83
- * Taro.redirectTo({
84
- * url: 'test?id=1'
85
- * })
86
- * ```
87
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html
88
- */
89
- function redirectTo(option: redirectTo.Option): Promise<General.CallbackResult>
90
-
91
43
  namespace navigateTo {
92
44
  interface Option {
93
45
  /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
94
46
  url: string
95
47
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
96
- complete?: (res: General.CallbackResult) => void
48
+ complete?: (res: TaroGeneral.CallbackResult) => void
97
49
  /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。 */
98
- events?: General.IAnyObject
50
+ events?: TaroGeneral.IAnyObject
99
51
  /** 接口调用失败的回调函数 */
100
- fail?: (res: General.CallbackResult) => void
52
+ fail?: (res: TaroGeneral.CallbackResult) => void
101
53
  /** 接口调用成功的回调函数 */
102
- success?: (res: General.CallbackResult & { eventChannel: EventChannel }) => void
54
+ success?: (res: TaroGeneral.CallbackResult & { eventChannel: EventChannel }) => void
103
55
  }
104
56
  }
105
57
 
106
- /** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。
107
- * @supported weapp, h5, rn
108
- * @example
109
- * ```tsx
110
- * Taro.navigateTo({
111
- * url: 'test?id=1',
112
- * events: {
113
- * // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
114
- * acceptDataFromOpenedPage: function(data) {
115
- * console.log(data)
116
- * },
117
- * someEvent: function(data) {
118
- * console.log(data)
119
- * }
120
- * ...
121
- * },
122
- * success: function (res) {
123
- * // 通过eventChannel向被打开页面传送数据
124
- * res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
125
- * }
126
- * })
127
- * ```
128
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
129
- */
130
- function navigateTo(option: navigateTo.Option): Promise<General.CallbackResult>
131
-
132
58
  namespace navigateBack {
133
59
  interface Option {
134
60
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
135
- complete?: (res: General.CallbackResult) => void
61
+ complete?: (res: TaroGeneral.CallbackResult) => void
136
62
  /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */
137
63
  delta?: number
138
64
  /** 接口调用失败的回调函数 */
139
- fail?: (res: General.CallbackResult) => void
65
+ fail?: (res: TaroGeneral.CallbackResult) => void
140
66
  /** 接口调用成功的回调函数 */
141
- success?: (res: General.CallbackResult) => void
67
+ success?: (res: TaroGeneral.CallbackResult) => void
142
68
  }
143
69
  }
144
70
 
145
- /** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
146
- * @supported weapp, h5, rn
147
- * @example
148
- * ```tsx
149
- * // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
150
- * // 此处是A页面
151
- * Taro.navigateTo({
152
- * url: 'B?id=1'
153
- * })
154
- * // 此处是B页面
155
- * Taro.navigateTo({
156
- * url: 'C?id=1'
157
- * })
158
- * // 在C页面内 navigateBack,将返回A页面
159
- * Taro.navigateBack({
160
- * delta: 2
161
- * })
162
- * ```
163
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html
164
- */
165
- function navigateBack(option?: navigateBack.Option): Promise<General.CallbackResult>
166
-
167
71
  interface EventChannel {
168
72
  /** 触发一个事件
169
73
  * @supported weapp
@@ -183,7 +87,7 @@ declare namespace Taro {
183
87
  /** 事件名称 */
184
88
  eventName: string,
185
89
  /** 事件监听函数 */
186
- fn: General.EventCallback,
90
+ fn: TaroGeneral.EventCallback,
187
91
  ): void
188
92
  /** 持续监听一个事件
189
93
  * @supported weapp
@@ -193,7 +97,7 @@ declare namespace Taro {
193
97
  /** 事件名称 */
194
98
  eventName: string,
195
99
  /** 事件监听函数 */
196
- fn: General.EventCallback,
100
+ fn: TaroGeneral.EventCallback,
197
101
  ): void
198
102
  /** 监听一个事件一次,触发后失效
199
103
  * @supported weapp
@@ -203,7 +107,107 @@ declare namespace Taro {
203
107
  /** 事件名称 */
204
108
  eventName: string,
205
109
  /** 事件监听函数 */
206
- fn: General.EventCallback,
110
+ fn: TaroGeneral.EventCallback,
207
111
  ): void
208
112
  }
113
+
114
+ interface TaroStatic {
115
+ /** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
116
+ * @supported weapp, h5, rn
117
+ * @example
118
+ * ```json
119
+ * {
120
+ * "tabBar": {
121
+ * "list": [{
122
+ * "pagePath": "index",
123
+ * "text": "首页"
124
+ * },{
125
+ * "pagePath": "other",
126
+ * "text": "其他"
127
+ * }]
128
+ * }
129
+ * }
130
+ * ```
131
+ *
132
+ * ```tsx
133
+ * Taro.switchTab({
134
+ * url: '/index'
135
+ * })
136
+ * ```
137
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html
138
+ */
139
+ switchTab(option: switchTab.Option): Promise<TaroGeneral.CallbackResult>
140
+
141
+ /** 关闭所有页面,打开到应用内的某个页面
142
+ * @supported weapp, h5, rn
143
+ * @example
144
+ * ```tsx
145
+ * Taro.reLaunch({
146
+ * url: 'test?id=1'
147
+ * })
148
+ * ```
149
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html
150
+ */
151
+ reLaunch(option: reLaunch.Option): Promise<TaroGeneral.CallbackResult>
152
+
153
+ /** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
154
+ * @supported weapp, h5, rn
155
+ * @example
156
+ * ```tsx
157
+ * Taro.redirectTo({
158
+ * url: 'test?id=1'
159
+ * })
160
+ * ```
161
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html
162
+ */
163
+ redirectTo(option: redirectTo.Option): Promise<TaroGeneral.CallbackResult>
164
+
165
+ /** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。
166
+ * @supported weapp, h5, rn
167
+ * @example
168
+ * ```tsx
169
+ * Taro.navigateTo({
170
+ * url: 'test?id=1',
171
+ * events: {
172
+ * // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
173
+ * acceptDataFromOpenedPage: function(data) {
174
+ * console.log(data)
175
+ * },
176
+ * someEvent: function(data) {
177
+ * console.log(data)
178
+ * }
179
+ * ...
180
+ * },
181
+ * success: function (res) {
182
+ * // 通过eventChannel向被打开页面传送数据
183
+ * res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
184
+ * }
185
+ * })
186
+ * ```
187
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
188
+ */
189
+ navigateTo(option: navigateTo.Option): Promise<TaroGeneral.CallbackResult>
190
+
191
+ /** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
192
+ * @supported weapp, h5, rn
193
+ * @example
194
+ * ```tsx
195
+ * // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
196
+ * // 此处是A页面
197
+ * Taro.navigateTo({
198
+ * url: 'B?id=1'
199
+ * })
200
+ * // 此处是B页面
201
+ * Taro.navigateTo({
202
+ * url: 'C?id=1'
203
+ * })
204
+ * // 在C页面内 navigateBack,将返回A页面
205
+ * Taro.navigateBack({
206
+ * delta: 2
207
+ * })
208
+ * ```
209
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html
210
+ */
211
+ navigateBack(option?: navigateBack.Option): Promise<TaroGeneral.CallbackResult>
212
+ }
209
213
  }
@@ -1,16 +1,18 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace updateShareMenu {
3
5
  interface Option {
4
6
  /** 动态消息的 activityId。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取 */
5
7
  activityId?: string
6
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?: (res: General.CallbackResult) => void
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用失败的回调函数 */
9
- fail?: (res: General.CallbackResult) => void
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
12
  /** 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html) */
11
13
  isUpdatableMessage?: boolean
12
14
  /** 接口调用成功的回调函数 */
13
- success?: (res: General.CallbackResult) => void
15
+ success?: (res: TaroGeneral.CallbackResult) => void
14
16
  /** 动态消息的模板信息 */
15
17
  templateInfo?: UpdatableMessageFrontEndTemplateInfo
16
18
  /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
@@ -31,27 +33,14 @@ declare namespace Taro {
31
33
  }
32
34
  }
33
35
 
34
- /** 更新转发属性
35
- * @supported weapp
36
- * @example
37
- * ```tsx
38
- * Taro.updateShareMenu({
39
- * withShareTicket: true,
40
- * success () { }
41
- * })
42
- * ```
43
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html
44
- */
45
- function updateShareMenu(option: updateShareMenu.Option): Promise<General.CallbackResult>
46
-
47
36
  namespace showShareMenu {
48
37
  interface Option {
49
38
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
50
- complete?: (res: General.CallbackResult) => void
39
+ complete?: (res: TaroGeneral.CallbackResult) => void
51
40
  /** 接口调用失败的回调函数 */
52
- fail?: (res: General.CallbackResult) => void
41
+ fail?: (res: TaroGeneral.CallbackResult) => void
53
42
  /** 接口调用成功的回调函数 */
54
- success?: (res: General.CallbackResult) => void
43
+ success?: (res: TaroGeneral.CallbackResult) => void
55
44
  /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
56
45
  withShareTicket?: boolean
57
46
  /** QQ小程序分享功能,支持分享到QQ、QQ空间、微信好友、微信朋友圈
@@ -62,54 +51,32 @@ declare namespace Taro {
62
51
  }
63
52
  }
64
53
 
65
- /** 显示当前页面的转发按钮
66
- * @supported weapp
67
- * @example
68
- * ```tsx
69
- * Taro.showShareMenu({
70
- * withShareTicket: true
71
- * })
72
- * ```
73
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html
74
- */
75
- function showShareMenu(option: showShareMenu.Option): Promise<General.CallbackResult>
76
-
77
54
  namespace hideShareMenu {
78
55
  interface Option {
79
56
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
80
- complete?: (res: General.CallbackResult) => void
57
+ complete?: (res: TaroGeneral.CallbackResult) => void
81
58
  /** 接口调用失败的回调函数 */
82
- fail?: (res: General.CallbackResult) => void
59
+ fail?: (res: TaroGeneral.CallbackResult) => void
83
60
  /** 接口调用成功的回调函数 */
84
- success?: (res: General.CallbackResult) => void
61
+ success?: (res: TaroGeneral.CallbackResult) => void
85
62
  }
86
63
  }
87
64
 
88
- /** 隐藏转发按钮
89
- * @supported weapp
90
- * @example
91
- * ```tsx
92
- * Taro.hideShareMenu()
93
- * ```
94
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html
95
- */
96
- function hideShareMenu(option?: hideShareMenu.Option): Promise<General.CallbackResult>
97
-
98
65
  namespace getShareInfo {
99
66
  interface Option {
100
67
  /** shareTicket */
101
68
  shareTicket: string
102
69
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
103
- complete?: (res: General.CallbackResult) => void
70
+ complete?: (res: TaroGeneral.CallbackResult) => void
104
71
  /** 接口调用失败的回调函数 */
105
- fail?: (res: General.CallbackResult) => void
72
+ fail?: (res: TaroGeneral.CallbackResult) => void
106
73
  /** 接口调用成功的回调函数 */
107
74
  success?: (result: SuccessCallbackResult) => void
108
75
  /** 超时时间,单位 ms */
109
76
  timeout?: number
110
77
  }
111
78
 
112
- interface SuccessCallbackResult extends General.CallbackResult {
79
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
113
80
  /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
114
81
  cloudID?: string
115
82
  /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
@@ -121,20 +88,57 @@ declare namespace Taro {
121
88
  }
122
89
  }
123
90
 
124
- /** 获取转发详细信息
125
- *
126
- * **Tips**
127
- * - 如需要展示群名称,可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-ability/open-data.html)
128
- * @supported weapp
129
- * @example
130
- * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
131
- * 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识):
132
- * ```json
133
- * {
134
- * "openGId": "OPENGID"
135
- * }
136
- * ```
137
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html
138
- */
139
- function getShareInfo(option: getShareInfo.Option): Promise<getShareInfo.SuccessCallbackResult>
91
+ interface TaroStatic {
92
+ /** 更新转发属性
93
+ * @supported weapp
94
+ * @example
95
+ * ```tsx
96
+ * Taro.updateShareMenu({
97
+ * withShareTicket: true,
98
+ * success () { }
99
+ * })
100
+ * ```
101
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html
102
+ */
103
+ updateShareMenu(option: updateShareMenu.Option): Promise<TaroGeneral.CallbackResult>
104
+
105
+ /** 显示当前页面的转发按钮
106
+ * @supported weapp
107
+ * @example
108
+ * ```tsx
109
+ * Taro.showShareMenu({
110
+ * withShareTicket: true
111
+ * })
112
+ * ```
113
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html
114
+ */
115
+ showShareMenu(option: showShareMenu.Option): Promise<TaroGeneral.CallbackResult>
116
+
117
+ /** 隐藏转发按钮
118
+ * @supported weapp
119
+ * @example
120
+ * ```tsx
121
+ * Taro.hideShareMenu()
122
+ * ```
123
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html
124
+ */
125
+ hideShareMenu(option?: hideShareMenu.Option): Promise<TaroGeneral.CallbackResult>
126
+
127
+ /** 获取转发详细信息
128
+ *
129
+ * **Tips**
130
+ * - 如需要展示群名称,可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-ability/open-data.html)
131
+ * @supported weapp
132
+ * @example
133
+ * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
134
+ * 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识):
135
+ * ```json
136
+ * {
137
+ * "openGId": "OPENGID"
138
+ * }
139
+ * ```
140
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html
141
+ */
142
+ getShareInfo(option: getShareInfo.Option): Promise<getShareInfo.SuccessCallbackResult>
143
+ }
140
144
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  // 周期性更新
3
5
 
4
6
  namespace setBackgroundFetchToken {
@@ -6,69 +8,72 @@ declare namespace Taro {
6
8
  /** 自定义的登录态 */
7
9
  token: string
8
10
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
- complete?: (res: General.CallbackResult) => void
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
10
12
  /** 接口调用失败的回调函数 */
11
- fail?: (res: General.CallbackResult) => void
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
12
14
  /** 接口调用成功的回调函数 */
13
- success?: (res: General.CallbackResult) => void
15
+ success?: (res: TaroGeneral.CallbackResult) => void
14
16
  }
15
17
  }
16
18
 
17
- /** 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性
18
- * @supported weapp
19
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html
20
- */
21
- function setBackgroundFetchToken(option: setBackgroundFetchToken.Option): void
22
-
23
19
  namespace onBackgroundFetchData {
24
20
  interface Option {
25
21
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
26
- complete?: (res: General.CallbackResult) => void
22
+ complete?: (res: TaroGeneral.CallbackResult) => void
27
23
  /** 接口调用失败的回调函数 */
28
- fail?: (res: General.CallbackResult) => void
24
+ fail?: (res: TaroGeneral.CallbackResult) => void
29
25
  /** 接口调用成功的回调函数 */
30
- success?: (res: General.CallbackResult) => void
26
+ success?: (res: TaroGeneral.CallbackResult) => void
31
27
  }
32
28
  }
33
- /** 收到 backgroundFetch 数据时的回调
34
- * @supported weapp
35
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html
36
- */
37
- function onBackgroundFetchData(option?: onBackgroundFetchData.Option): void
38
29
 
39
30
  namespace getBackgroundFetchToken {
40
31
  interface Option {
41
32
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
42
- complete?: (res: General.CallbackResult) => void
33
+ complete?: (res: TaroGeneral.CallbackResult) => void
43
34
  /** 接口调用失败的回调函数 */
44
- fail?: (res: General.CallbackResult) => void
35
+ fail?: (res: TaroGeneral.CallbackResult) => void
45
36
  /** 接口调用成功的回调函数 */
46
- success?: (res: General.CallbackResult) => void
37
+ success?: (res: TaroGeneral.CallbackResult) => void
47
38
  }
48
39
  }
49
40
 
50
- /** 获取设置过的自定义登录态。若无,则返回 fail。
51
- * @supported weapp
52
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html
53
- */
54
- function getBackgroundFetchToken(option?: getBackgroundFetchToken.Option): void
55
-
56
41
  namespace getBackgroundFetchData {
57
42
  interface Option {
58
43
  /** 取值为 periodic */
59
44
  fetchType: string
60
45
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
61
- complete?: (res: General.CallbackResult) => void
46
+ complete?: (res: TaroGeneral.CallbackResult) => void
62
47
  /** 接口调用失败的回调函数 */
63
- fail?: (res: General.CallbackResult) => void
48
+ fail?: (res: TaroGeneral.CallbackResult) => void
64
49
  /** 接口调用成功的回调函数 */
65
- success?: (res: General.CallbackResult) => void
50
+ success?: (res: TaroGeneral.CallbackResult) => void
66
51
  }
67
52
  }
68
53
 
69
- /** 拉取 backgroundFetch 客户端缓存数据
70
- * @supported weapp
71
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html
72
- */
73
- function getBackgroundFetchData(option: getBackgroundFetchData.Option): void
54
+ interface TaroStatic {
55
+ /** 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性
56
+ * @supported weapp
57
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html
58
+ */
59
+ setBackgroundFetchToken(option: setBackgroundFetchToken.Option): void
60
+
61
+ /** 收到 backgroundFetch 数据时的回调
62
+ * @supported weapp
63
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html
64
+ */
65
+ onBackgroundFetchData(option?: onBackgroundFetchData.Option): void
66
+
67
+ /** 获取设置过的自定义登录态。若无,则返回 fail。
68
+ * @supported weapp
69
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html
70
+ */
71
+ getBackgroundFetchToken(option?: getBackgroundFetchToken.Option): void
72
+
73
+ /** 拉取 backgroundFetch 客户端缓存数据
74
+ * @supported weapp
75
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html
76
+ */
77
+ getBackgroundFetchData(option: getBackgroundFetchData.Option): void
78
+ }
74
79
  }