@tarojs/taro 3.3.13 → 3.3.17

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 (98) 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 +116 -111
  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 +80 -42
  25. package/types/api/device/nfc.d.ts +105 -96
  26. package/types/api/device/performance.d.ts +32 -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 +163 -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 +40 -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 +66 -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 +159 -150
  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/compile.d.ts +1 -5
  88. package/types/global.d.ts +392 -0
  89. package/types/index.d.ts +12 -98
  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 +28 -6
  93. package/types/taro.extend.d.ts +50 -75
  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
@@ -1,135 +1,122 @@
1
- declare namespace Taro {
2
- /** 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
3
- * @supported weapp
4
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html
5
- */
6
- function createLivePusherContext(): LivePusherContext
7
- /** 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。
8
- * @supported weapp
9
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html
10
- */
11
- function createLivePlayerContext(
12
- /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
13
- id: string,
14
- /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */
15
- component?: General.IAnyObject,
16
- ): LivePlayerContext
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
17
4
  namespace LivePusherContext {
18
5
  interface PauseOption {
19
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
20
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
21
8
  /** 接口调用失败的回调函数 */
22
- fail?: (res: General.CallbackResult) => void
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
23
10
  /** 接口调用成功的回调函数 */
24
- success?: (res: General.CallbackResult) => void
11
+ success?: (res: TaroGeneral.CallbackResult) => void
25
12
  }
26
13
  interface PauseBGMOption {
27
14
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
- complete?: (res: General.CallbackResult) => void
15
+ complete?: (res: TaroGeneral.CallbackResult) => void
29
16
  /** 接口调用失败的回调函数 */
30
- fail?: (res: General.CallbackResult) => void
17
+ fail?: (res: TaroGeneral.CallbackResult) => void
31
18
  /** 接口调用成功的回调函数 */
32
- success?: (res: General.CallbackResult) => void
19
+ success?: (res: TaroGeneral.CallbackResult) => void
33
20
  }
34
21
  interface PlayBGMOption {
35
22
  /** 加入背景混音的资源地址 */
36
23
  url: string
37
24
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
38
- complete?: (res: General.CallbackResult) => void
25
+ complete?: (res: TaroGeneral.CallbackResult) => void
39
26
  /** 接口调用失败的回调函数 */
40
- fail?: (res: General.CallbackResult) => void
27
+ fail?: (res: TaroGeneral.CallbackResult) => void
41
28
  /** 接口调用成功的回调函数 */
42
- success?: (res: General.CallbackResult) => void
29
+ success?: (res: TaroGeneral.CallbackResult) => void
43
30
  }
44
31
  interface ResumeOption {
45
32
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
46
- complete?: (res: General.CallbackResult) => void
33
+ complete?: (res: TaroGeneral.CallbackResult) => void
47
34
  /** 接口调用失败的回调函数 */
48
- fail?: (res: General.CallbackResult) => void
35
+ fail?: (res: TaroGeneral.CallbackResult) => void
49
36
  /** 接口调用成功的回调函数 */
50
- success?: (res: General.CallbackResult) => void
37
+ success?: (res: TaroGeneral.CallbackResult) => void
51
38
  }
52
39
  interface ResumeBGMOption {
53
40
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
54
- complete?: (res: General.CallbackResult) => void
41
+ complete?: (res: TaroGeneral.CallbackResult) => void
55
42
  /** 接口调用失败的回调函数 */
56
- fail?: (res: General.CallbackResult) => void
43
+ fail?: (res: TaroGeneral.CallbackResult) => void
57
44
  /** 接口调用成功的回调函数 */
58
- success?: (res: General.CallbackResult) => void
45
+ success?: (res: TaroGeneral.CallbackResult) => void
59
46
  }
60
47
  interface SetBGMVolumeOption {
61
48
  /** 音量大小,范围是 0-1 */
62
49
  volume: string
63
50
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
64
- complete?: (res: General.CallbackResult) => void
51
+ complete?: (res: TaroGeneral.CallbackResult) => void
65
52
  /** 接口调用失败的回调函数 */
66
- fail?: (res: General.CallbackResult) => void
53
+ fail?: (res: TaroGeneral.CallbackResult) => void
67
54
  /** 接口调用成功的回调函数 */
68
- success?: (res: General.CallbackResult) => void
55
+ success?: (res: TaroGeneral.CallbackResult) => void
69
56
  }
70
57
  interface SnapshotOption {
71
58
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
72
- complete?: (res: General.CallbackResult) => void
59
+ complete?: (res: TaroGeneral.CallbackResult) => void
73
60
  /** 接口调用失败的回调函数 */
74
- fail?: (res: General.CallbackResult) => void
61
+ fail?: (res: TaroGeneral.CallbackResult) => void
75
62
  /** 接口调用成功的回调函数 */
76
- success?: (res: General.CallbackResult) => void
63
+ success?: (res: TaroGeneral.CallbackResult) => void
77
64
  }
78
65
  interface StartOption {
79
66
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
80
- complete?: (res: General.CallbackResult) => void
67
+ complete?: (res: TaroGeneral.CallbackResult) => void
81
68
  /** 接口调用失败的回调函数 */
82
- fail?: (res: General.CallbackResult) => void
69
+ fail?: (res: TaroGeneral.CallbackResult) => void
83
70
  /** 接口调用成功的回调函数 */
84
- success?: (res: General.CallbackResult) => void
71
+ success?: (res: TaroGeneral.CallbackResult) => void
85
72
  }
86
73
  interface StartPreviewOption {
87
74
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
88
- complete?: (res: General.CallbackResult) => void
75
+ complete?: (res: TaroGeneral.CallbackResult) => void
89
76
  /** 接口调用失败的回调函数 */
90
- fail?: (res: General.CallbackResult) => void
77
+ fail?: (res: TaroGeneral.CallbackResult) => void
91
78
  /** 接口调用成功的回调函数 */
92
- success?: (res: General.CallbackResult) => void
79
+ success?: (res: TaroGeneral.CallbackResult) => void
93
80
  }
94
81
  interface StopOption {
95
82
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
96
- complete?: (res: General.CallbackResult) => void
83
+ complete?: (res: TaroGeneral.CallbackResult) => void
97
84
  /** 接口调用失败的回调函数 */
98
- fail?: (res: General.CallbackResult) => void
85
+ fail?: (res: TaroGeneral.CallbackResult) => void
99
86
  /** 接口调用成功的回调函数 */
100
- success?: (res: General.CallbackResult) => void
87
+ success?: (res: TaroGeneral.CallbackResult) => void
101
88
  }
102
89
  interface StopBGMOption {
103
90
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
104
- complete?: (res: General.CallbackResult) => void
91
+ complete?: (res: TaroGeneral.CallbackResult) => void
105
92
  /** 接口调用失败的回调函数 */
106
- fail?: (res: General.CallbackResult) => void
93
+ fail?: (res: TaroGeneral.CallbackResult) => void
107
94
  /** 接口调用成功的回调函数 */
108
- success?: (res: General.CallbackResult) => void
95
+ success?: (res: TaroGeneral.CallbackResult) => void
109
96
  }
110
97
  interface StopPreviewOption {
111
98
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
112
- complete?: (res: General.CallbackResult) => void
99
+ complete?: (res: TaroGeneral.CallbackResult) => void
113
100
  /** 接口调用失败的回调函数 */
114
- fail?: (res: General.CallbackResult) => void
101
+ fail?: (res: TaroGeneral.CallbackResult) => void
115
102
  /** 接口调用成功的回调函数 */
116
- success?: (res: General.CallbackResult) => void
103
+ success?: (res: TaroGeneral.CallbackResult) => void
117
104
  }
118
105
  interface SwitchCameraOption {
119
106
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
120
- complete?: (res: General.CallbackResult) => void
107
+ complete?: (res: TaroGeneral.CallbackResult) => void
121
108
  /** 接口调用失败的回调函数 */
122
- fail?: (res: General.CallbackResult) => void
109
+ fail?: (res: TaroGeneral.CallbackResult) => void
123
110
  /** 接口调用成功的回调函数 */
124
- success?: (res: General.CallbackResult) => void
111
+ success?: (res: TaroGeneral.CallbackResult) => void
125
112
  }
126
113
  interface ToggleTorchOption {
127
114
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
128
- complete?: (res: General.CallbackResult) => void
115
+ complete?: (res: TaroGeneral.CallbackResult) => void
129
116
  /** 接口调用失败的回调函数 */
130
- fail?: (res: General.CallbackResult) => void
117
+ fail?: (res: TaroGeneral.CallbackResult) => void
131
118
  /** 接口调用成功的回调函数 */
132
- success?: (res: General.CallbackResult) => void
119
+ success?: (res: TaroGeneral.CallbackResult) => void
133
120
  }
134
121
  }
135
122
  /** `LivePusherContext` 实例,可通过 `Taro.createLivePusherContext` 获取。
@@ -211,39 +198,39 @@ declare namespace Taro {
211
198
  namespace LivePlayerContext {
212
199
  interface ExitFullScreenOption {
213
200
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
214
- complete?: (res: General.CallbackResult) => void
201
+ complete?: (res: TaroGeneral.CallbackResult) => void
215
202
  /** 接口调用失败的回调函数 */
216
- fail?: (res: General.CallbackResult) => void
203
+ fail?: (res: TaroGeneral.CallbackResult) => void
217
204
  /** 接口调用成功的回调函数 */
218
- success?: (res: General.CallbackResult) => void
205
+ success?: (res: TaroGeneral.CallbackResult) => void
219
206
  }
220
207
  interface MuteOption {
221
208
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
222
- complete?: (res: General.CallbackResult) => void
209
+ complete?: (res: TaroGeneral.CallbackResult) => void
223
210
  /** 接口调用失败的回调函数 */
224
- fail?: (res: General.CallbackResult) => void
211
+ fail?: (res: TaroGeneral.CallbackResult) => void
225
212
  /** 接口调用成功的回调函数 */
226
- success?: (res: General.CallbackResult) => void
213
+ success?: (res: TaroGeneral.CallbackResult) => void
227
214
  }
228
215
  interface PauseOption {
229
216
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
230
- complete?: (res: General.CallbackResult) => void
217
+ complete?: (res: TaroGeneral.CallbackResult) => void
231
218
  /** 接口调用失败的回调函数 */
232
- fail?: (res: General.CallbackResult) => void
219
+ fail?: (res: TaroGeneral.CallbackResult) => void
233
220
  /** 接口调用成功的回调函数 */
234
- success?: (res: General.CallbackResult) => void
221
+ success?: (res: TaroGeneral.CallbackResult) => void
235
222
  }
236
223
  interface PlayOption {
237
224
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
238
- complete?: (res: General.CallbackResult) => void
225
+ complete?: (res: TaroGeneral.CallbackResult) => void
239
226
  /** 接口调用失败的回调函数 */
240
- fail?: (res: General.CallbackResult) => void
227
+ fail?: (res: TaroGeneral.CallbackResult) => void
241
228
  /** 接口调用成功的回调函数 */
242
- success?: (res: General.CallbackResult) => void
229
+ success?: (res: TaroGeneral.CallbackResult) => void
243
230
  }
244
231
  interface RequestFullScreenOption {
245
232
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
246
- complete?: (res: General.CallbackResult) => void
233
+ complete?: (res: TaroGeneral.CallbackResult) => void
247
234
  /** 设置全屏时的方向
248
235
  *
249
236
  * 可选值:
@@ -252,27 +239,27 @@ declare namespace Taro {
252
239
  * - -90: 屏幕顺时针90度; */
253
240
  direction?: 0 | 90 | -90
254
241
  /** 接口调用失败的回调函数 */
255
- fail?: (res: General.CallbackResult) => void
242
+ fail?: (res: TaroGeneral.CallbackResult) => void
256
243
  /** 接口调用成功的回调函数 */
257
- success?: (res: General.CallbackResult) => void
244
+ success?: (res: TaroGeneral.CallbackResult) => void
258
245
  }
259
246
  interface ResumeOption {
260
247
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
261
- complete?: (res: General.CallbackResult) => void
248
+ complete?: (res: TaroGeneral.CallbackResult) => void
262
249
  /** 接口调用失败的回调函数 */
263
- fail?: (res: General.CallbackResult) => void
250
+ fail?: (res: TaroGeneral.CallbackResult) => void
264
251
  /** 接口调用成功的回调函数 */
265
- success?: (res: General.CallbackResult) => void
252
+ success?: (res: TaroGeneral.CallbackResult) => void
266
253
  }
267
254
  interface SnapshotOption {
268
255
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
269
- complete?: (res: General.CallbackResult) => void
256
+ complete?: (res: TaroGeneral.CallbackResult) => void
270
257
  /** 接口调用失败的回调函数 */
271
- fail?: (res: General.CallbackResult) => void
258
+ fail?: (res: TaroGeneral.CallbackResult) => void
272
259
  /** 接口调用成功的回调函数 */
273
260
  success?: (result: SnapshotSuccessCallbackResult) => void
274
261
  }
275
- interface SnapshotSuccessCallbackResult extends General.CallbackResult {
262
+ interface SnapshotSuccessCallbackResult extends TaroGeneral.CallbackResult {
276
263
  /** 图片的高度 */
277
264
  height: string
278
265
  /** 图片文件的临时路径 */
@@ -284,11 +271,11 @@ declare namespace Taro {
284
271
  }
285
272
  interface StopOption {
286
273
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
287
- complete?: (res: General.CallbackResult) => void
274
+ complete?: (res: TaroGeneral.CallbackResult) => void
288
275
  /** 接口调用失败的回调函数 */
289
- fail?: (res: General.CallbackResult) => void
276
+ fail?: (res: TaroGeneral.CallbackResult) => void
290
277
  /** 接口调用成功的回调函数 */
291
- success?: (res: General.CallbackResult) => void
278
+ success?: (res: TaroGeneral.CallbackResult) => void
292
279
  }
293
280
  }
294
281
 
@@ -340,4 +327,23 @@ declare namespace Taro {
340
327
  */
341
328
  stop(option?: LivePlayerContext.StopOption): void
342
329
  }
330
+
331
+ interface TaroStatic {
332
+ /** 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
333
+ * @supported weapp
334
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html
335
+ */
336
+ createLivePusherContext(): LivePusherContext
337
+
338
+ /** 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。
339
+ * @supported weapp
340
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html
341
+ */
342
+ createLivePlayerContext(
343
+ /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
344
+ id: string,
345
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */
346
+ component?: TaroGeneral.IAnyObject,
347
+ ): LivePlayerContext
348
+ }
343
349
  }
@@ -1,20 +1,6 @@
1
- declare namespace Taro {
2
- /**
3
- * 创建 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 上下文 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 对象。
4
- * @supported weapp
5
- * @example
6
- * ```tsx
7
- * const mapCtx = Taro.createMapContext('myMap')
8
- * ```
9
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html
10
- */
11
- function createMapContext(
12
- /** Map 组件的 id */
13
- mapId: string,
14
- /** 在自定义组件下,当前组件实例的this,以操作组件内 Map 组件 */
15
- component?: General.IAnyObject,
16
- ): MapContext
1
+ import Taro from '../../index'
17
2
 
3
+ declare module '../../index' {
18
4
  /** `MapContext` 实例,可通过 Taro.createMapContext 获取。
19
5
  * `MapContext` 通过 id 跟一个 map 组件绑定,操作对应的 map 组件。
20
6
  */
@@ -48,24 +34,24 @@ declare namespace Taro {
48
34
  * @supported weapp
49
35
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html
50
36
  */
51
- includePoints(option: MapContext.IncludePointsOption): Promise<General.CallbackResult>
37
+ includePoints(option: MapContext.IncludePointsOption): Promise<TaroGeneral.CallbackResult>
52
38
  /** 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。
53
39
  * @supported weapp
54
40
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html
55
41
  */
56
- moveToLocation(option: MapContext.MoveToLocationOption): Promise<General.CallbackResult>
42
+ moveToLocation(option: MapContext.MoveToLocationOption): Promise<TaroGeneral.CallbackResult>
57
43
  /** 平移marker,带动画
58
44
  * @supported weapp
59
45
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html
60
46
  */
61
- translateMarker(option: MapContext.TranslateMarkerOption): Promise<General.CallbackResult>
47
+ translateMarker(option: MapContext.TranslateMarkerOption): Promise<TaroGeneral.CallbackResult>
62
48
  }
63
49
  namespace MapContext {
64
50
  interface GetCenterLocationOption {
65
51
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
66
- complete?: (res: General.CallbackResult) => void
52
+ complete?: (res: TaroGeneral.CallbackResult) => void
67
53
  /** 接口调用失败的回调函数 */
68
- fail?: (res: General.CallbackResult) => void
54
+ fail?: (res: TaroGeneral.CallbackResult) => void
69
55
  /** 接口调用成功的回调函数 */
70
56
  success?: GetCenterLocationSuccessCallback
71
57
  }
@@ -73,7 +59,7 @@ declare namespace Taro {
73
59
  type GetCenterLocationSuccessCallback = (
74
60
  result: GetCenterLocationSuccessCallbackResult,
75
61
  ) => void
76
- interface GetCenterLocationSuccessCallbackResult extends General.CallbackResult {
62
+ interface GetCenterLocationSuccessCallbackResult extends TaroGeneral.CallbackResult {
77
63
  /** 纬度 */
78
64
  latitude: number
79
65
  /** 经度 */
@@ -83,9 +69,9 @@ declare namespace Taro {
83
69
  }
84
70
  interface GetRegionOption {
85
71
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
86
- complete?: (res: General.CallbackResult) => void
72
+ complete?: (res: TaroGeneral.CallbackResult) => void
87
73
  /** 接口调用失败的回调函数 */
88
- fail?: (res: General.CallbackResult) => void
74
+ fail?: (res: TaroGeneral.CallbackResult) => void
89
75
  /** 接口调用成功的回调函数 */
90
76
  success?: GetRegionSuccessCallback
91
77
  }
@@ -93,7 +79,7 @@ declare namespace Taro {
93
79
  type GetRegionSuccessCallback = (
94
80
  result: GetRegionSuccessCallbackResult,
95
81
  ) => void
96
- interface GetRegionSuccessCallbackResult extends General.CallbackResult {
82
+ interface GetRegionSuccessCallbackResult extends TaroGeneral.CallbackResult {
97
83
  /** 东北角经纬度 */
98
84
  northeast: MapPostion
99
85
  /** 西南角经纬度 */
@@ -103,9 +89,9 @@ declare namespace Taro {
103
89
  }
104
90
  interface GetRotateOption {
105
91
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
106
- complete?: (res: General.CallbackResult) => void
92
+ complete?: (res: TaroGeneral.CallbackResult) => void
107
93
  /** 接口调用失败的回调函数 */
108
- fail?: (res: General.CallbackResult) => void
94
+ fail?: (res: TaroGeneral.CallbackResult) => void
109
95
  /** 接口调用成功的回调函数 */
110
96
  success?: GetRotateSuccessCallback
111
97
  }
@@ -113,7 +99,7 @@ declare namespace Taro {
113
99
  type GetRotateSuccessCallback = (
114
100
  result: GetRotateSuccessCallbackResult,
115
101
  ) => void
116
- interface GetRotateSuccessCallbackResult extends General.CallbackResult {
102
+ interface GetRotateSuccessCallbackResult extends TaroGeneral.CallbackResult {
117
103
  /** 旋转角 */
118
104
  rotate: number
119
105
  /** 调用结果 */
@@ -121,9 +107,9 @@ declare namespace Taro {
121
107
  }
122
108
  interface GetScaleOption {
123
109
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
124
- complete?: (res: General.CallbackResult) => void
110
+ complete?: (res: TaroGeneral.CallbackResult) => void
125
111
  /** 接口调用失败的回调函数 */
126
- fail?: (res: General.CallbackResult) => void
112
+ fail?: (res: TaroGeneral.CallbackResult) => void
127
113
  /** 接口调用成功的回调函数 */
128
114
  success?: GetScaleSuccessCallback
129
115
  }
@@ -131,7 +117,7 @@ declare namespace Taro {
131
117
  type GetScaleSuccessCallback = (
132
118
  result: GetScaleSuccessCallbackResult,
133
119
  ) => void
134
- interface GetScaleSuccessCallbackResult extends General.CallbackResult {
120
+ interface GetScaleSuccessCallbackResult extends TaroGeneral.CallbackResult {
135
121
  /** 缩放值 */
136
122
  scale: number
137
123
  /** 调用结果 */
@@ -139,15 +125,15 @@ declare namespace Taro {
139
125
  }
140
126
  interface GetSkewOption {
141
127
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
142
- complete?: (res: General.CallbackResult) => void
128
+ complete?: (res: TaroGeneral.CallbackResult) => void
143
129
  /** 接口调用失败的回调函数 */
144
- fail?: (res: General.CallbackResult) => void
130
+ fail?: (res: TaroGeneral.CallbackResult) => void
145
131
  /** 接口调用成功的回调函数 */
146
132
  success?: GetSkewSuccessCallback
147
133
  }
148
134
  /** 接口调用成功的回调函数 */
149
135
  type GetSkewSuccessCallback = (result: GetSkewSuccessCallbackResult) => void
150
- interface GetSkewSuccessCallbackResult extends General.CallbackResult {
136
+ interface GetSkewSuccessCallbackResult extends TaroGeneral.CallbackResult {
151
137
  /** 倾斜角 */
152
138
  skew: number
153
139
  /** 调用结果 */
@@ -157,13 +143,13 @@ declare namespace Taro {
157
143
  /** 要显示在可视区域内的坐标点列表 */
158
144
  points: MapPostion[]
159
145
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
160
- complete?: (res: General.CallbackResult) => void
146
+ complete?: (res: TaroGeneral.CallbackResult) => void
161
147
  /** 接口调用失败的回调函数 */
162
- fail?: (res: General.CallbackResult) => void
148
+ fail?: (res: TaroGeneral.CallbackResult) => void
163
149
  /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */
164
150
  padding?: number[]
165
151
  /** 接口调用成功的回调函数 */
166
- success?: (res: General.CallbackResult) => void
152
+ success?: (res: TaroGeneral.CallbackResult) => void
167
153
  }
168
154
  /** 要显示在可视区域内的坐标点列表 */
169
155
  interface MapPostion {
@@ -174,15 +160,15 @@ declare namespace Taro {
174
160
  }
175
161
  interface MoveToLocationOption {
176
162
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
177
- complete?: (res: General.CallbackResult) => void
163
+ complete?: (res: TaroGeneral.CallbackResult) => void
178
164
  /** 接口调用失败的回调函数 */
179
- fail?: (res: General.CallbackResult) => void
165
+ fail?: (res: TaroGeneral.CallbackResult) => void
180
166
  /** 纬度 */
181
167
  latitude?: number
182
168
  /** 经度 */
183
169
  longitude?: number
184
170
  /** 接口调用成功的回调函数 */
185
- success?: (res: General.CallbackResult) => void
171
+ success?: (res: TaroGeneral.CallbackResult) => void
186
172
  }
187
173
  interface TranslateMarkerOption {
188
174
  /** 移动过程中是否自动旋转 marker */
@@ -196,13 +182,13 @@ declare namespace Taro {
196
182
  /** 动画结束回调函数 */
197
183
  animationEnd?: (...args: any[]) => any
198
184
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
199
- complete?: (res: General.CallbackResult) => void
185
+ complete?: (res: TaroGeneral.CallbackResult) => void
200
186
  /** 动画持续时长,平移与旋转分别计算 */
201
187
  duration?: number
202
188
  /** 接口调用失败的回调函数 */
203
- fail?: (res: General.CallbackResult) => void
189
+ fail?: (res: TaroGeneral.CallbackResult) => void
204
190
  /** 接口调用成功的回调函数 */
205
- success?: (res: General.CallbackResult) => void
191
+ success?: (res: TaroGeneral.CallbackResult) => void
206
192
  } /** 指定 marker 移动到的目标点 */
207
193
  interface DestinationOption {
208
194
  /** 纬度 */
@@ -211,4 +197,22 @@ declare namespace Taro {
211
197
  longitude: number
212
198
  }
213
199
  }
200
+
201
+ interface TaroStatic {
202
+ /**
203
+ * 创建 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 上下文 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 对象。
204
+ * @supported weapp
205
+ * @example
206
+ * ```tsx
207
+ * const mapCtx = Taro.createMapContext('myMap')
208
+ * ```
209
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html
210
+ */
211
+ createMapContext(
212
+ /** Map 组件的 id */
213
+ mapId: string,
214
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 Map 组件 */
215
+ component?: TaroGeneral.IAnyObject,
216
+ ): MapContext
217
+ }
214
218
  }