@spcsn/taro 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace startDeviceMotionListening {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 监听设备方向的变化回调函数的执行频率
|
|
11
|
+
* @default "normal"
|
|
12
|
+
*/
|
|
13
|
+
interval?: keyof Interval
|
|
14
|
+
/** 接口调用成功的回调函数 */
|
|
15
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
16
|
+
}
|
|
17
|
+
interface Interval {
|
|
18
|
+
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
|
19
|
+
game
|
|
20
|
+
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
|
21
|
+
ui
|
|
22
|
+
/** 普通的回调频率,在 200ms/次 左右 */
|
|
23
|
+
normal
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
namespace stopDeviceMotionListening {
|
|
28
|
+
interface Option {
|
|
29
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
30
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
31
|
+
/** 接口调用失败的回调函数 */
|
|
32
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
33
|
+
/** 接口调用成功的回调函数 */
|
|
34
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
namespace onDeviceMotionChange {
|
|
39
|
+
/** 设备方向变化事件的回调函数 */
|
|
40
|
+
type Callback = (result: CallbackResult) => void
|
|
41
|
+
|
|
42
|
+
interface CallbackResult {
|
|
43
|
+
/** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
|
|
44
|
+
alpha: number
|
|
45
|
+
/** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */
|
|
46
|
+
beta: number
|
|
47
|
+
/** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */
|
|
48
|
+
gamma: number
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface TaroStatic {
|
|
53
|
+
/** 开始监听设备方向的变化。
|
|
54
|
+
* @supported weapp, swan, jd, h5, rn
|
|
55
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html
|
|
56
|
+
*/
|
|
57
|
+
startDeviceMotionListening(
|
|
58
|
+
option: startDeviceMotionListening.Option,
|
|
59
|
+
): void
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 停止监听设备方向的变化。
|
|
63
|
+
* @supported weapp, swan, jd, h5, rn
|
|
64
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html
|
|
65
|
+
*/
|
|
66
|
+
stopDeviceMotionListening(
|
|
67
|
+
option?: stopDeviceMotionListening.Option,
|
|
68
|
+
): void
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 监听设备方向变化事件。频率根据 Taro.startDeviceMotionListening() 的 interval 参数。可以使用 Taro.stopDeviceMotionListening() 停止监听。
|
|
72
|
+
* @supported weapp, alipay, swan, jd, h5, rn
|
|
73
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html
|
|
74
|
+
*/
|
|
75
|
+
onDeviceMotionChange(
|
|
76
|
+
callback: onDeviceMotionChange.Callback
|
|
77
|
+
): void
|
|
78
|
+
|
|
79
|
+
/** 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
|
|
80
|
+
* @supported weapp, alipay, swan, jd, h5, rn
|
|
81
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html
|
|
82
|
+
*/
|
|
83
|
+
offDeviceMotionChange(
|
|
84
|
+
/** 设备方向变化事件的回调函数 */
|
|
85
|
+
callback?: onDeviceMotionChange.Callback
|
|
86
|
+
): void
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace onNetworkWeakChange {
|
|
5
|
+
/** 弱网状态变化事件的回调函数 */
|
|
6
|
+
type Callback = (
|
|
7
|
+
result: CallbackResult,
|
|
8
|
+
) => void
|
|
9
|
+
|
|
10
|
+
interface CallbackResult {
|
|
11
|
+
/** 当前是否处于弱网状态 */
|
|
12
|
+
weakNet: boolean
|
|
13
|
+
/** 当前网络类型 */
|
|
14
|
+
networkType: keyof getNetworkType.NetworkType
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
namespace onNetworkStatusChange {
|
|
19
|
+
/** 网络状态变化事件的回调函数 */
|
|
20
|
+
type Callback = (
|
|
21
|
+
result: CallbackResult,
|
|
22
|
+
) => void
|
|
23
|
+
|
|
24
|
+
interface CallbackResult {
|
|
25
|
+
/** 当前是否有网络连接 */
|
|
26
|
+
isConnected: boolean
|
|
27
|
+
/** 网络类型 */
|
|
28
|
+
networkType: keyof getNetworkType.NetworkType
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
namespace getNetworkType {
|
|
33
|
+
interface Option {
|
|
34
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
35
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
36
|
+
/** 接口调用失败的回调函数 */
|
|
37
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
38
|
+
/** 接口调用成功的回调函数 */
|
|
39
|
+
success?: (result: SuccessCallbackResult) => void
|
|
40
|
+
}
|
|
41
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
42
|
+
/** 网络类型 */
|
|
43
|
+
networkType: keyof NetworkType
|
|
44
|
+
/** 信号强弱,单位 dbm */
|
|
45
|
+
signalStrength?: number
|
|
46
|
+
/** 设备是否使用了网络代理 */
|
|
47
|
+
hasSystemProxy?: boolean
|
|
48
|
+
/** 调用结果 */
|
|
49
|
+
errMsg: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** 网络类型 */
|
|
53
|
+
interface NetworkType {
|
|
54
|
+
/** wifi 网络 */
|
|
55
|
+
wifi
|
|
56
|
+
/** 2g 网络 */
|
|
57
|
+
'2g'
|
|
58
|
+
/** 3g 网络 */
|
|
59
|
+
'3g'
|
|
60
|
+
/** 4g 网络 */
|
|
61
|
+
'4g'
|
|
62
|
+
/** 5g 网络 */
|
|
63
|
+
'5g'
|
|
64
|
+
/** Android 下不常见的网络类型 */
|
|
65
|
+
'unknown'
|
|
66
|
+
/** 无网络 */
|
|
67
|
+
'none'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
namespace getLocalIPAddress {
|
|
72
|
+
interface Option {
|
|
73
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
74
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
75
|
+
/** 接口调用失败的回调函数 */
|
|
76
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
77
|
+
/** 接口调用成功的回调函数 */
|
|
78
|
+
success?: (result: SuccessCallbackResult) => void
|
|
79
|
+
}
|
|
80
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
81
|
+
/** 本机局域网IP地址 */
|
|
82
|
+
localip: string
|
|
83
|
+
/** ,基础库 2.24.0 开始支持 */
|
|
84
|
+
netmask?: string
|
|
85
|
+
/** 调用结果 */
|
|
86
|
+
errMsg: string
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface TaroStatic {
|
|
91
|
+
/** 监听弱网状态变化事件
|
|
92
|
+
* @supported weapp, swan, qq, tt
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* Taro.onNetworkWeakChange(function (res) {
|
|
96
|
+
* console.log(res.weakNet)
|
|
97
|
+
* console.log(res.networkType)
|
|
98
|
+
* })
|
|
99
|
+
* // 取消监听
|
|
100
|
+
* Taro.offNetworkWeakChange()
|
|
101
|
+
* ```
|
|
102
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkWeakChange.html
|
|
103
|
+
*/
|
|
104
|
+
onNetworkWeakChange(
|
|
105
|
+
/** 弱网状态变化事件的回调函数 */
|
|
106
|
+
callback: onNetworkWeakChange.Callback,
|
|
107
|
+
): void
|
|
108
|
+
|
|
109
|
+
/** 监听网络状态变化。
|
|
110
|
+
* @supported weapp, swan, h5, rn, tt, harmony, harmony_hybrid
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* Taro.onNetworkStatusChange(function (res) {
|
|
114
|
+
* console.log(res.isConnected)
|
|
115
|
+
* console.log(res.networkType)
|
|
116
|
+
* })
|
|
117
|
+
* ```
|
|
118
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html
|
|
119
|
+
*/
|
|
120
|
+
onNetworkStatusChange(
|
|
121
|
+
/** 网络状态变化事件的回调函数 */
|
|
122
|
+
callback: onNetworkStatusChange.Callback,
|
|
123
|
+
): void
|
|
124
|
+
|
|
125
|
+
/** 取消监听弱网状态变化事件
|
|
126
|
+
* @supported weapp, swan
|
|
127
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html
|
|
128
|
+
*/
|
|
129
|
+
offNetworkWeakChange(
|
|
130
|
+
/** 弱网状态变化事件的回调函数 */
|
|
131
|
+
callback?: onNetworkWeakChange.Callback,
|
|
132
|
+
): void
|
|
133
|
+
|
|
134
|
+
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
|
|
135
|
+
* @supported weapp, swan, h5, rn, harmony, harmony_hybrid
|
|
136
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
|
|
137
|
+
*/
|
|
138
|
+
offNetworkStatusChange(
|
|
139
|
+
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听 */
|
|
140
|
+
callback?: onNetworkStatusChange.Callback,
|
|
141
|
+
): void
|
|
142
|
+
|
|
143
|
+
/** 获取网络类型。
|
|
144
|
+
* @supported weapp, swan, qq, h5, rn, tt, harmony, harmony_hybrid
|
|
145
|
+
* @example
|
|
146
|
+
* ```tsx
|
|
147
|
+
* Taro.getNetworkType({
|
|
148
|
+
* success: function (res) {
|
|
149
|
+
* // 返回网络类型, 有效值:
|
|
150
|
+
* // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
|
|
151
|
+
* var networkType = res.networkType
|
|
152
|
+
* }
|
|
153
|
+
* })
|
|
154
|
+
* ```
|
|
155
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html
|
|
156
|
+
*/
|
|
157
|
+
getNetworkType(option?: getNetworkType.Option): Promise<getNetworkType.SuccessCallbackResult>
|
|
158
|
+
|
|
159
|
+
/** 获取局域网IP地址。
|
|
160
|
+
* @supported weapp
|
|
161
|
+
* @example
|
|
162
|
+
* ```tsx
|
|
163
|
+
* Taro.getLocalIPAddress()
|
|
164
|
+
* .then(res => {
|
|
165
|
+
* const localip = res.localip
|
|
166
|
+
* })
|
|
167
|
+
* ```
|
|
168
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getLocalIPAddress.html
|
|
169
|
+
*/
|
|
170
|
+
getLocalIPAddress(option?: getLocalIPAddress.Option): Promise<getLocalIPAddress.SuccessCallbackResult>
|
|
171
|
+
}
|
|
172
|
+
}
|