@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,39 +1,27 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace hideKeyboard {
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
- /** 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
14
- * @supported weapp, rn
15
- * @example
16
- * ```tsx
17
- * Taro.hideKeyboard({
18
- * complete: res => {
19
- * console.log('hideKeyboard res', res)
20
- * }
21
- * })
22
- * ```
23
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.hideKeyboard.html
24
- */
25
- function hideKeyboard(option?: hideKeyboard.Option): Promise<General.CallbackResult>
26
-
27
15
  namespace getSelectedTextRange {
28
16
  interface Option {
29
17
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
30
- complete?: (res: General.CallbackResult) => void
18
+ complete?: (res: TaroGeneral.CallbackResult) => void
31
19
  /** 接口调用失败的回调函数 */
32
- fail?: (res: General.CallbackResult) => void
20
+ fail?: (res: TaroGeneral.CallbackResult) => void
33
21
  /** 接口调用成功的回调函数 */
34
22
  success?: (result: SuccessCallbackResult) => void
35
23
  }
36
- interface SuccessCallbackResult extends General.CallbackResult {
24
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
37
25
  /** 输入框光标结束位置 */
38
26
  end: number
39
27
  /** 输入框光标起始位置 */
@@ -43,20 +31,6 @@ declare namespace Taro {
43
31
  }
44
32
  }
45
33
 
46
- /** 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。
47
- * @supported weapp
48
- * @example
49
- * ```tsx
50
- * Taro.getSelectedTextRange({
51
- * complete: res => {
52
- * console.log('getSelectedTextRange res', res.start, res.end)
53
- * }
54
- * })
55
- * ```
56
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.getSelectedTextRange.html
57
- */
58
- function getSelectedTextRange(option?: getSelectedTextRange.Option): Promise<getSelectedTextRange.SuccessCallbackResult>
59
-
60
34
  namespace onKeyboardHeightChange {
61
35
  type Callback = (
62
36
  result: CallbackResult,
@@ -67,25 +41,55 @@ declare namespace Taro {
67
41
  }
68
42
  }
69
43
 
70
- /** 监听键盘高度变化
71
- * @supported weapp, rn
72
- * @example
73
- * ```tsx
74
- * Taro.onKeyboardHeightChange(res => {
75
- * console.log(res.height)
76
- * })
77
- * ```
78
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html
79
- */
80
- function onKeyboardHeightChange(callback: onKeyboardHeightChange.Callback): void
44
+ interface TaroStatic {
45
+ /** 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
46
+ * @supported weapp, rn
47
+ * @example
48
+ * ```tsx
49
+ * Taro.hideKeyboard({
50
+ * complete: res => {
51
+ * console.log('hideKeyboard res', res)
52
+ * }
53
+ * })
54
+ * ```
55
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.hideKeyboard.html
56
+ */
57
+ hideKeyboard(option?: hideKeyboard.Option): Promise<TaroGeneral.CallbackResult>
81
58
 
82
- /**
83
- * 取消监听键盘高度变化事件。
84
- * @supported weapp, rn
85
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html
86
- */
87
- function offKeyboardHeightChange(
88
- /** 键盘高度变化事件的回调函数 */
89
- callback?: (...args: any[]) => any,
90
- ): void
59
+ /** 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。
60
+ * @supported weapp
61
+ * @example
62
+ * ```tsx
63
+ * Taro.getSelectedTextRange({
64
+ * complete: res => {
65
+ * console.log('getSelectedTextRange res', res.start, res.end)
66
+ * }
67
+ * })
68
+ * ```
69
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.getSelectedTextRange.html
70
+ */
71
+ getSelectedTextRange(option?: getSelectedTextRange.Option): Promise<getSelectedTextRange.SuccessCallbackResult>
72
+
73
+ /** 监听键盘高度变化
74
+ * @supported weapp, rn
75
+ * @example
76
+ * ```tsx
77
+ * Taro.onKeyboardHeightChange(res => {
78
+ * console.log(res.height)
79
+ * })
80
+ * ```
81
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html
82
+ */
83
+ onKeyboardHeightChange(callback: onKeyboardHeightChange.Callback): void
84
+
85
+ /**
86
+ * 取消监听键盘高度变化事件。
87
+ * @supported weapp, rn
88
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html
89
+ */
90
+ offKeyboardHeightChange(
91
+ /** 键盘高度变化事件的回调函数 */
92
+ callback?: (...args: any[]) => any,
93
+ ): void
94
+ }
91
95
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace getMenuButtonBoundingClientRect {
3
5
  /** 菜单按钮的布局位置信息 */
4
6
  interface Rect {
@@ -17,9 +19,11 @@ declare namespace Taro {
17
19
  }
18
20
  }
19
21
 
20
- /** 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
21
- * @supported weapp
22
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html
23
- */
24
- function getMenuButtonBoundingClientRect(): getMenuButtonBoundingClientRect.Rect
22
+ interface TaroStatic {
23
+ /** 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
24
+ * @supported weapp
25
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html
26
+ */
27
+ getMenuButtonBoundingClientRect(): getMenuButtonBoundingClientRect.Rect
28
+ }
25
29
  }
@@ -1,46 +1,30 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace showNavigationBarLoading {
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
- * @supported weapp, rn
15
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html
16
- */
17
- function showNavigationBarLoading(option?: showNavigationBarLoading.Option): void
18
-
19
15
  namespace setNavigationBarTitle {
20
16
  interface Option {
21
17
  /** 页面标题 */
22
18
  title: string
23
19
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
24
- complete?: (res: General.CallbackResult) => void
20
+ complete?: (res: TaroGeneral.CallbackResult) => void
25
21
  /** 接口调用失败的回调函数 */
26
- fail?: (res: General.CallbackResult) => void
22
+ fail?: (res: TaroGeneral.CallbackResult) => void
27
23
  /** 接口调用成功的回调函数 */
28
- success?: (res: General.CallbackResult) => void
24
+ success?: (res: TaroGeneral.CallbackResult) => void
29
25
  }
30
26
  }
31
27
 
32
- /** 动态设置当前页面的标题
33
- * @supported weapp, h5, rn
34
- * @example
35
- * ```tsx
36
- * Taro.setNavigationBarTitle({
37
- * title: '当前页面'
38
- * })
39
- * ```
40
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html
41
- */
42
- function setNavigationBarTitle(option: setNavigationBarTitle.Option): Promise<General.CallbackResult>
43
-
44
28
  namespace setNavigationBarColor {
45
29
  interface Option {
46
30
  /** 背景颜色值,有效值为十六进制颜色 */
@@ -50,11 +34,11 @@ declare namespace Taro {
50
34
  /** 动画效果 */
51
35
  animation?: AnimationOption
52
36
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
53
- complete?: (res: General.CallbackResult) => void
37
+ complete?: (res: TaroGeneral.CallbackResult) => void
54
38
  /** 接口调用失败的回调函数 */
55
- fail?: (res: General.CallbackResult) => void
39
+ fail?: (res: TaroGeneral.CallbackResult) => void
56
40
  /** 接口调用成功的回调函数 */
57
- success?: (res: General.CallbackResult) => void
41
+ success?: (res: TaroGeneral.CallbackResult) => void
58
42
  }
59
43
  /** 动画效果 */
60
44
  interface AnimationOption {
@@ -71,55 +55,75 @@ declare namespace Taro {
71
55
  }
72
56
  }
73
57
 
74
- /** 设置页面导航条颜色
75
- * @supported weapp, h5, rn
76
- * @rn 不支持 animation 参数
77
- * @example
78
- * ```tsx
79
- * Taro.setNavigationBarColor({
80
- * frontColor: '#ffffff',
81
- * backgroundColor: '#ff0000',
82
- * animation: {
83
- * duration: 400,
84
- * timingFunc: 'easeIn'
85
- * }
86
- * })
87
- * ```
88
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html
89
- */
90
- function setNavigationBarColor(option: setNavigationBarColor.Option): Promise<General.CallbackResult>
91
-
92
58
  namespace hideNavigationBarLoading {
93
59
  interface Option {
94
60
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
95
- complete?: (res: General.CallbackResult) => void
61
+ complete?: (res: TaroGeneral.CallbackResult) => void
96
62
  /** 接口调用失败的回调函数 */
97
- fail?: (res: General.CallbackResult) => void
63
+ fail?: (res: TaroGeneral.CallbackResult) => void
98
64
  /** 接口调用成功的回调函数 */
99
- success?: (res: General.CallbackResult) => void
65
+ success?: (res: TaroGeneral.CallbackResult) => void
100
66
  }
101
67
  }
102
68
 
103
- /** 在当前页面隐藏导航条加载动画
104
- * @supported weapp, rn
105
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html
106
- */
107
- function hideNavigationBarLoading(option?: hideNavigationBarLoading.Option): void
108
-
109
69
  namespace hideHomeButton {
110
70
  interface Option {
111
71
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
112
- complete?: (res: General.CallbackResult) => void
72
+ complete?: (res: TaroGeneral.CallbackResult) => void
113
73
  /** 接口调用失败的回调函数 */
114
- fail?: (res: General.CallbackResult) => void
74
+ fail?: (res: TaroGeneral.CallbackResult) => void
115
75
  /** 接口调用成功的回调函数 */
116
- success?: (res: General.CallbackResult) => void
76
+ success?: (res: TaroGeneral.CallbackResult) => void
117
77
  }
118
78
  }
119
79
 
120
- /** 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。
121
- * @supported weapp
122
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html
123
- */
124
- function hideHomeButton(option?: hideHomeButton.Option): Promise<General.CallbackResult>
80
+ interface TaroStatic {
81
+ /** 在当前页面显示导航条加载动画
82
+ * @supported weapp, rn
83
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html
84
+ */
85
+ showNavigationBarLoading(option?: showNavigationBarLoading.Option): void
86
+
87
+ /** 动态设置当前页面的标题
88
+ * @supported weapp, h5, rn
89
+ * @example
90
+ * ```tsx
91
+ * Taro.setNavigationBarTitle({
92
+ * title: '当前页面'
93
+ * })
94
+ * ```
95
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html
96
+ */
97
+ setNavigationBarTitle(option: setNavigationBarTitle.Option): Promise<TaroGeneral.CallbackResult>
98
+
99
+ /** 设置页面导航条颜色
100
+ * @supported weapp, h5, rn
101
+ * @rn 不支持 animation 参数
102
+ * @example
103
+ * ```tsx
104
+ * Taro.setNavigationBarColor({
105
+ * frontColor: '#ffffff',
106
+ * backgroundColor: '#ff0000',
107
+ * animation: {
108
+ * duration: 400,
109
+ * timingFunc: 'easeIn'
110
+ * }
111
+ * })
112
+ * ```
113
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html
114
+ */
115
+ setNavigationBarColor(option: setNavigationBarColor.Option): Promise<TaroGeneral.CallbackResult>
116
+
117
+ /** 在当前页面隐藏导航条加载动画
118
+ * @supported weapp, rn
119
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html
120
+ */
121
+ hideNavigationBarLoading(option?: hideNavigationBarLoading.Option): void
122
+
123
+ /** 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。
124
+ * @supported weapp
125
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html
126
+ */
127
+ hideHomeButton(option?: hideHomeButton.Option): Promise<TaroGeneral.CallbackResult>
128
+ }
125
129
  }
@@ -1,46 +1,50 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace stopPullDownRefresh {
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
- * @supported weapp, h5, rn
15
- * @example
16
- * ```tsx
17
- * onPullDownRefresh: function (){
18
- * Taro.stopPullDownRefresh()
19
- * }
20
- * ```
21
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html
22
- */
23
- function stopPullDownRefresh(option?: stopPullDownRefresh.Option): void
24
-
25
15
  namespace startPullDownRefresh {
26
16
  interface Option {
27
17
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
- complete?: (res: General.CallbackResult) => void
18
+ complete?: (res: TaroGeneral.CallbackResult) => void
29
19
  /** 接口调用失败的回调函数 */
30
- fail?: (res: General.CallbackResult) => void
20
+ fail?: (res: TaroGeneral.CallbackResult) => void
31
21
  /** 接口调用成功的回调函数 */
32
- success?: (res: General.CallbackResult) => void
22
+ success?: (res: TaroGeneral.CallbackResult) => void
33
23
  }
34
24
  }
35
25
 
36
- /** 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
37
- * @supported weapp, h5, rn
38
- * @rn 无动画效果
39
- * @example
40
- * ```tsx
41
- * Taro.startPullDownRefresh()
42
- * ```
43
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html
44
- */
45
- function startPullDownRefresh(option?: startPullDownRefresh.Option): Promise<General.CallbackResult>
26
+ interface TaroStatic {
27
+ /** 停止当前页面下拉刷新。
28
+ * @supported weapp, h5, rn
29
+ * @example
30
+ * ```tsx
31
+ * onPullDownRefresh: function (){
32
+ * Taro.stopPullDownRefresh()
33
+ * }
34
+ * ```
35
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html
36
+ */
37
+ stopPullDownRefresh(option?: stopPullDownRefresh.Option): void
38
+
39
+ /** 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
40
+ * @supported weapp, h5, rn
41
+ * @rn 无动画效果
42
+ * @example
43
+ * ```tsx
44
+ * Taro.startPullDownRefresh()
45
+ * ```
46
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html
47
+ */
48
+ startPullDownRefresh(option?: startPullDownRefresh.Option): Promise<TaroGeneral.CallbackResult>
49
+ }
46
50
  }
@@ -1,41 +1,45 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace pageScrollTo {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
6
8
  /** 滚动动画的时长,单位 ms */
7
9
  duration?: number
8
10
  /** 接口调用失败的回调函数 */
9
- fail?: (res: General.CallbackResult) => void
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
12
  /** 滚动到页面的目标位置,单位 px */
11
13
  scrollTop?: number
12
14
  /** 选择器, css selector */
13
15
  selector?: string
14
16
  /** 接口调用成功的回调函数 */
15
- success?: (res: General.CallbackResult) => void
17
+ success?: (res: TaroGeneral.CallbackResult) => void
16
18
  }
17
19
  }
18
20
 
19
- /** 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
20
- *
21
- * **selector 语法**
22
- * selector类似于 CSS 的选择器,但仅支持下列语法。
23
- *
24
- * + ID选择器:#the-id
25
- * + class选择器(可以连续指定多个):.a-class.another-class
26
- * + 子元素选择器:.the-parent > .the-child
27
- * + 后代选择器:.the-ancestor .the-descendant
28
- * + 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
29
- * + 多选择器的并集:#a-node, .some-other-nodes
30
- * @supported weapp, h5
31
- * @example
32
- * ```tsx
33
- * Taro.pageScrollTo({
34
- * scrollTop: 0,
35
- * duration: 300
36
- * })
37
- * ```
38
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html
39
- */
40
- function pageScrollTo(option: pageScrollTo.Option): Promise<General.CallbackResult>
21
+ interface TaroStatic {
22
+ /** 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
23
+ *
24
+ * **selector 语法**
25
+ * selector类似于 CSS 的选择器,但仅支持下列语法。
26
+ *
27
+ * + ID选择器:#the-id
28
+ * + class选择器(可以连续指定多个):.a-class.another-class
29
+ * + 子元素选择器:.the-parent > .the-child
30
+ * + 后代选择器:.the-ancestor .the-descendant
31
+ * + 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
32
+ * + 多选择器的并集:#a-node, .some-other-nodes
33
+ * @supported weapp, h5
34
+ * @example
35
+ * ```tsx
36
+ * Taro.pageScrollTo({
37
+ * scrollTop: 0,
38
+ * duration: 300
39
+ * })
40
+ * ```
41
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html
42
+ */
43
+ pageScrollTo(option: pageScrollTo.Option): Promise<TaroGeneral.CallbackResult>
44
+ }
41
45
  }
@@ -1,29 +1,32 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace setTopBarText {
3
5
  interface Option {
4
6
  /** 置顶栏文字 */
5
7
  text: 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
-
15
- /** 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容.
16
- *
17
- * **注意**
18
- * - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently"
19
- * @supported weapp
20
- * @example
21
- * ```tsx
22
- * Taro.setTopBarText({
23
- * text: 'hello, world!'
24
- * })
25
- * ```
26
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html
27
- */
28
- function setTopBarText(option: setTopBarText.Option): Promise<General.CallbackResult>
16
+ interface TaroStatic {
17
+ /** 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容.
18
+ *
19
+ * **注意**
20
+ * - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently"
21
+ * @supported weapp
22
+ * @example
23
+ * ```tsx
24
+ * Taro.setTopBarText({
25
+ * text: 'hello, world!'
26
+ * })
27
+ * ```
28
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html
29
+ */
30
+ setTopBarText(option: setTopBarText.Option): Promise<TaroGeneral.CallbackResult>
31
+ }
29
32
  }