@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,105 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace stopCompass {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace startCompass {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
18
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
19
|
+
/** 接口调用失败的回调函数 */
|
|
20
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
21
|
+
/** 接口调用成功的回调函数 */
|
|
22
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
namespace onCompassChange {
|
|
27
|
+
/** 罗盘数据变化事件的回调函数 */
|
|
28
|
+
type Callback = (
|
|
29
|
+
result: OnCompassChangeCallbackResult,
|
|
30
|
+
) => void
|
|
31
|
+
interface OnCompassChangeCallbackResult {
|
|
32
|
+
/** 精度
|
|
33
|
+
*
|
|
34
|
+
* 由于平台差异,accuracy 在 iOS/Android 的值不同。
|
|
35
|
+
*
|
|
36
|
+
* - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
|
|
37
|
+
* - Android:accuracy 是一个 string 类型的枚举值。
|
|
38
|
+
*/
|
|
39
|
+
accuracy: number | keyof accuracy | string
|
|
40
|
+
/** 面对的方向度数 */
|
|
41
|
+
direction: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface accuracy {
|
|
45
|
+
/** 高精度 */
|
|
46
|
+
high
|
|
47
|
+
/** 中等精度 */
|
|
48
|
+
medium
|
|
49
|
+
/** 低精度 */
|
|
50
|
+
low
|
|
51
|
+
/** 不可信,传感器失去连接 */
|
|
52
|
+
'no-contact'
|
|
53
|
+
/** 不可信,原因未知 */
|
|
54
|
+
unreliable
|
|
55
|
+
/** 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值 */
|
|
56
|
+
'unknow ${value}'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface TaroStatic {
|
|
61
|
+
/** 停止监听罗盘数据
|
|
62
|
+
* @supported weapp, swan, qq, h5, tt
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* Taro.stopCompass()
|
|
66
|
+
* ```
|
|
67
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html
|
|
68
|
+
*/
|
|
69
|
+
stopCompass(option?: stopCompass.Option): Promise<TaroGeneral.CallbackResult>
|
|
70
|
+
|
|
71
|
+
/** 开始监听罗盘数据
|
|
72
|
+
* @supported weapp, swan, qq, h5, tt
|
|
73
|
+
* @example
|
|
74
|
+
* ```js
|
|
75
|
+
* Taro.startCompass()
|
|
76
|
+
* ```
|
|
77
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html
|
|
78
|
+
*/
|
|
79
|
+
startCompass(option?: startCompass.Option): Promise<TaroGeneral.CallbackResult>
|
|
80
|
+
|
|
81
|
+
/** 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 Taro.stopCompass 停止监听。
|
|
82
|
+
* @supported weapp, swan, qq, h5, tt
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* Taro.onCompassChange(function (res) {
|
|
86
|
+
* console.log(res.direction)
|
|
87
|
+
* })
|
|
88
|
+
* ```
|
|
89
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html
|
|
90
|
+
*/
|
|
91
|
+
onCompassChange(
|
|
92
|
+
/** 罗盘数据变化事件的回调函数 */
|
|
93
|
+
callback: onCompassChange.Callback,
|
|
94
|
+
): void
|
|
95
|
+
|
|
96
|
+
/** 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
|
|
97
|
+
* @supported weapp, swan, qq, h5
|
|
98
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html
|
|
99
|
+
*/
|
|
100
|
+
offCompassChange(
|
|
101
|
+
/** 罗盘数据变化事件的回调函数 */
|
|
102
|
+
callback?: onCompassChange.Callback,
|
|
103
|
+
): void
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace chooseContact {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (result: SuccessCallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
14
|
+
/** 手机号 */
|
|
15
|
+
phoneNumber: string
|
|
16
|
+
/** 联系人姓名 */
|
|
17
|
+
displayName: string
|
|
18
|
+
/** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */
|
|
19
|
+
phoneNumberList: string
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
namespace addPhoneContact {
|
|
24
|
+
interface Option {
|
|
25
|
+
/** 名字 */
|
|
26
|
+
firstName: string
|
|
27
|
+
/** 头像本地文件路径 */
|
|
28
|
+
photoFilePath?: string
|
|
29
|
+
/** 昵称 */
|
|
30
|
+
nickName?: string
|
|
31
|
+
/** 中间名 */
|
|
32
|
+
middleName?: string
|
|
33
|
+
/** 姓氏 */
|
|
34
|
+
lastName?: string
|
|
35
|
+
/** 备注 */
|
|
36
|
+
remark?: string
|
|
37
|
+
/** 手机号 */
|
|
38
|
+
mobilePhoneNumber?: string
|
|
39
|
+
/** 微信号 */
|
|
40
|
+
weChatNumber?: string
|
|
41
|
+
/** 联系地址国家 */
|
|
42
|
+
addressCountry?: string
|
|
43
|
+
/** 联系地址省份 */
|
|
44
|
+
addressState?: string
|
|
45
|
+
/** 联系地址城市 */
|
|
46
|
+
addressCity?: string
|
|
47
|
+
/** 联系地址街道 */
|
|
48
|
+
addressStreet?: string
|
|
49
|
+
/** 联系地址邮政编码 */
|
|
50
|
+
addressPostalCode?: string
|
|
51
|
+
/** 公司 */
|
|
52
|
+
organization?: string
|
|
53
|
+
/** 职位 */
|
|
54
|
+
title?: string
|
|
55
|
+
/** 工作传真 */
|
|
56
|
+
workFaxNumber?: string
|
|
57
|
+
/** 工作电话 */
|
|
58
|
+
workPhoneNumber?: string
|
|
59
|
+
/** 公司电话 */
|
|
60
|
+
hostNumber?: string
|
|
61
|
+
/** 电子邮件 */
|
|
62
|
+
email?: string
|
|
63
|
+
/** 网站 */
|
|
64
|
+
url?: string
|
|
65
|
+
/** 工作地址国家 */
|
|
66
|
+
workAddressCountry?: string
|
|
67
|
+
/** 工作地址省份 */
|
|
68
|
+
workAddressState?: string
|
|
69
|
+
/** 工作地址城市 */
|
|
70
|
+
workAddressCity?: string
|
|
71
|
+
/** 工作地址街道 */
|
|
72
|
+
workAddressStreet?: string
|
|
73
|
+
/** 工作地址邮政编码 */
|
|
74
|
+
workAddressPostalCode?: string
|
|
75
|
+
/** 住宅传真 */
|
|
76
|
+
homeFaxNumber?: string
|
|
77
|
+
/** 住宅电话 */
|
|
78
|
+
homePhoneNumber?: string
|
|
79
|
+
/** 住宅地址国家 */
|
|
80
|
+
homeAddressCountry?: string
|
|
81
|
+
/** 住宅地址省份 */
|
|
82
|
+
homeAddressState?: string
|
|
83
|
+
/** 住宅地址城市 */
|
|
84
|
+
homeAddressCity?: string
|
|
85
|
+
/** 住宅地址街道 */
|
|
86
|
+
homeAddressStreet?: string
|
|
87
|
+
/** 住宅地址邮政编码 */
|
|
88
|
+
homeAddressPostalCode?: string
|
|
89
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
90
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
91
|
+
/** 接口调用失败的回调函数 */
|
|
92
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
93
|
+
/** 接口调用成功的回调函数 */
|
|
94
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface TaroStatic {
|
|
99
|
+
/** 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
|
|
100
|
+
* @supported weapp
|
|
101
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html
|
|
102
|
+
*/
|
|
103
|
+
chooseContact(option: chooseContact.Option): Promise<chooseContact.SuccessCallbackResult>
|
|
104
|
+
/** 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
|
|
105
|
+
* @supported weapp
|
|
106
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html
|
|
107
|
+
*/
|
|
108
|
+
addPhoneContact(option: addPhoneContact.Option): Promise<TaroGeneral.CallbackResult>
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace stopGyroscope {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
namespace startGyroscope {
|
|
17
|
+
interface Option {
|
|
18
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
19
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
20
|
+
/** 接口调用失败的回调函数 */
|
|
21
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
22
|
+
/** 监听陀螺仪数据回调函数的执行频率 */
|
|
23
|
+
interval?: keyof Interval
|
|
24
|
+
/** 接口调用成功的回调函数 */
|
|
25
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 监听陀螺仪数据回调函数的执行频率 */
|
|
29
|
+
interface Interval {
|
|
30
|
+
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
|
31
|
+
game
|
|
32
|
+
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
|
33
|
+
ui
|
|
34
|
+
/** 普通的回调频率,在 200ms/次 左右 */
|
|
35
|
+
normal
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
namespace onGyroscopeChange {
|
|
40
|
+
/** 陀螺仪数据变化事件的回调函数 */
|
|
41
|
+
type Callback = (
|
|
42
|
+
result: CallbackResult,
|
|
43
|
+
) => void
|
|
44
|
+
interface CallbackResult {
|
|
45
|
+
/** x 轴的角速度 */
|
|
46
|
+
x: number
|
|
47
|
+
/** y 轴的角速度 */
|
|
48
|
+
y: number
|
|
49
|
+
/** z 轴的角速度 */
|
|
50
|
+
z: number
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface TaroStatic {
|
|
55
|
+
/** 停止监听陀螺仪数据。
|
|
56
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
57
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html
|
|
58
|
+
*/
|
|
59
|
+
stopGyroscope(option?: stopGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
60
|
+
|
|
61
|
+
/** 开始监听陀螺仪数据。
|
|
62
|
+
* @supported weapp, rn, tt
|
|
63
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html
|
|
64
|
+
*/
|
|
65
|
+
startGyroscope(option: startGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
66
|
+
|
|
67
|
+
/** 监听陀螺仪数据变化事件。频率根据 Taro.startGyroscope() 的 interval 参数。可以使用 Taro.stopGyroscope() 停止监听。
|
|
68
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
69
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
|
|
70
|
+
*/
|
|
71
|
+
onGyroscopeChange(
|
|
72
|
+
/** 陀螺仪数据变化事件的回调函数 */
|
|
73
|
+
callback: onGyroscopeChange.Callback,
|
|
74
|
+
): void
|
|
75
|
+
|
|
76
|
+
/** 取消监听陀螺仪数据变化事件。
|
|
77
|
+
* @supported weapp, alipay, swan, jd, tt, rn
|
|
78
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html
|
|
79
|
+
*/
|
|
80
|
+
offGyroscopeChange(
|
|
81
|
+
/** 陀螺仪数据变化事件的回调函数 */
|
|
82
|
+
callback?: onGyroscopeChange.Callback,
|
|
83
|
+
): void
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace stopBeaconDiscovery {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.IBeaconError) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.IBeaconError) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.IBeaconError) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace startBeaconDiscovery {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** iBeacon 设备广播的 uuid 列表 */
|
|
18
|
+
uuids: string[]
|
|
19
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
20
|
+
complete?: (res: TaroGeneral.IBeaconError) => void
|
|
21
|
+
/** 接口调用失败的回调函数 */
|
|
22
|
+
fail?: (res: TaroGeneral.IBeaconError) => void
|
|
23
|
+
/** 是否校验蓝牙开关,仅在 iOS 下有效
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
ignoreBluetoothAvailable?: boolean
|
|
27
|
+
/** 接口调用成功的回调函数 */
|
|
28
|
+
success?: (res: TaroGeneral.IBeaconError) => void
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
namespace onBeaconUpdate {
|
|
33
|
+
/** iBeacon 设备更新事件的回调函数 */
|
|
34
|
+
type Callback = (result: CallbackResult) => void
|
|
35
|
+
|
|
36
|
+
interface CallbackResult {
|
|
37
|
+
/** 当前搜寻到的所有 iBeacon 设备列表 */
|
|
38
|
+
beacons: IBeaconInfo[]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
namespace onBeaconServiceChange {
|
|
43
|
+
/** iBeacon 服务状态变化事件的回调函数 */
|
|
44
|
+
type Callback = (
|
|
45
|
+
result: CallbackResult,
|
|
46
|
+
) => void
|
|
47
|
+
|
|
48
|
+
interface CallbackResult {
|
|
49
|
+
/** 服务目前是否可用 */
|
|
50
|
+
available: boolean
|
|
51
|
+
/** 目前是否处于搜索状态 */
|
|
52
|
+
discovering: boolean
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
namespace getBeacons {
|
|
57
|
+
interface Option {
|
|
58
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
59
|
+
complete?: (res: TaroGeneral.IBeaconError) => void
|
|
60
|
+
/** 接口调用失败的回调函数 */
|
|
61
|
+
fail?: (res: TaroGeneral.IBeaconError) => void
|
|
62
|
+
/** 接口调用成功的回调函数 */
|
|
63
|
+
success?: (result: CallbackResult) => void
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface CallbackResult extends TaroGeneral.IBeaconError {
|
|
67
|
+
/** iBeacon 设备列表 */
|
|
68
|
+
beacons: IBeaconInfo[]
|
|
69
|
+
/** 调用结果 */
|
|
70
|
+
errMsg: string
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface IBeaconInfo {
|
|
75
|
+
/** Beacon 设备广播的 uuid */
|
|
76
|
+
uuid: string
|
|
77
|
+
/** Beacon 设备的主 ID */
|
|
78
|
+
major: string
|
|
79
|
+
/** Beacon 设备的次 ID */
|
|
80
|
+
minor: string
|
|
81
|
+
/** 表示设备距离的枚举值(仅iOS) */
|
|
82
|
+
proximity: keyof IBeaconInfo.Proximity
|
|
83
|
+
/** Beacon 设备的距离,单位 m。iOS 上,proximity 为 0 时,accuracy 为 -1。 */
|
|
84
|
+
accuracy: number
|
|
85
|
+
/** 表示设备的信号强度,单位 dBm */
|
|
86
|
+
rssi: number
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
namespace IBeaconInfo {
|
|
90
|
+
/** proximity 的合法值 */
|
|
91
|
+
interface Proximity {
|
|
92
|
+
/** 信号太弱不足以计算距离,或非 iOS 设备 */
|
|
93
|
+
0
|
|
94
|
+
/** 十分近 */
|
|
95
|
+
1
|
|
96
|
+
/** 比较近 */
|
|
97
|
+
2
|
|
98
|
+
/** 远 */
|
|
99
|
+
3
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface TaroStatic {
|
|
104
|
+
/** 停止搜索附近的 iBeacon 设备
|
|
105
|
+
* @supported weapp, alipay
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* Taro.stopBeaconDiscovery(params).then(...)
|
|
109
|
+
* ```
|
|
110
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html
|
|
111
|
+
*/
|
|
112
|
+
stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
|
|
113
|
+
|
|
114
|
+
/** 开始搜索附近的 iBeacon 设备
|
|
115
|
+
* @supported weapp, alipay
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* Taro.startBeaconDiscovery({
|
|
119
|
+
* success: function (res) { }
|
|
120
|
+
* })
|
|
121
|
+
* ```
|
|
122
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html
|
|
123
|
+
*/
|
|
124
|
+
startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
|
|
125
|
+
|
|
126
|
+
/** 监听 iBeacon 设备更新事件,仅能注册一个监听
|
|
127
|
+
* @supported weapp, alipay
|
|
128
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html
|
|
129
|
+
*/
|
|
130
|
+
onBeaconUpdate(
|
|
131
|
+
/** iBeacon 设备更新事件的回调函数 */
|
|
132
|
+
callback: onBeaconUpdate.Callback,
|
|
133
|
+
): void
|
|
134
|
+
|
|
135
|
+
/** 监听 iBeacon 服务状态变化事件,仅能注册一个监听
|
|
136
|
+
* @supported weapp, alipay
|
|
137
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html
|
|
138
|
+
*/
|
|
139
|
+
onBeaconServiceChange(
|
|
140
|
+
/** iBeacon 服务状态变化事件的回调函数 */
|
|
141
|
+
callback: onBeaconServiceChange.Callback,
|
|
142
|
+
): void
|
|
143
|
+
|
|
144
|
+
/** 取消监听 iBeacon 设备更新事件
|
|
145
|
+
* @supported weapp, alipay
|
|
146
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html
|
|
147
|
+
*/
|
|
148
|
+
offBeaconUpdate(
|
|
149
|
+
/** iBeacon 设备更新事件的回调函数 */
|
|
150
|
+
callback: (res: TaroGeneral.IBeaconError) => void,
|
|
151
|
+
): void
|
|
152
|
+
|
|
153
|
+
/** 取消监听 iBeacon 服务状态变化事件
|
|
154
|
+
* @supported weapp, alipay
|
|
155
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html
|
|
156
|
+
*/
|
|
157
|
+
offBeaconServiceChange(
|
|
158
|
+
/** iBeacon 服务状态变化事件的回调函数 */
|
|
159
|
+
callback: (res: TaroGeneral.IBeaconError) => void,
|
|
160
|
+
): void
|
|
161
|
+
|
|
162
|
+
/** 获取所有已搜索到的 iBeacon 设备
|
|
163
|
+
* @supported weapp, alipay
|
|
164
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html
|
|
165
|
+
*/
|
|
166
|
+
getBeacons(option?: getBeacons.Option): Promise<getBeacons.CallbackResult>
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace hideKeyboard {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace getSelectedTextRange {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
18
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
19
|
+
/** 接口调用失败的回调函数 */
|
|
20
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
21
|
+
/** 接口调用成功的回调函数 */
|
|
22
|
+
success?: (result: SuccessCallbackResult) => void
|
|
23
|
+
}
|
|
24
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
25
|
+
/** 输入框光标结束位置 */
|
|
26
|
+
end: number
|
|
27
|
+
/** 输入框光标起始位置 */
|
|
28
|
+
start: number
|
|
29
|
+
/** 调用结果 */
|
|
30
|
+
errMsg: string
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
namespace onKeyboardHeightChange {
|
|
35
|
+
type Callback = (
|
|
36
|
+
result: CallbackResult,
|
|
37
|
+
) => void
|
|
38
|
+
interface CallbackResult {
|
|
39
|
+
/** 键盘高度 */
|
|
40
|
+
height: number
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface TaroStatic {
|
|
45
|
+
/** 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
|
|
46
|
+
* @supported weapp, alipay, swan, jd, tt, rn, harmony_hybrid, harmony
|
|
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>
|
|
58
|
+
|
|
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, swan, jd, qq, rn, harmony
|
|
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(
|
|
84
|
+
callback: onKeyboardHeightChange.Callback
|
|
85
|
+
): void
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 取消监听键盘高度变化事件。
|
|
89
|
+
* @supported weapp, swan, jd, rn, harmony
|
|
90
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html
|
|
91
|
+
*/
|
|
92
|
+
offKeyboardHeightChange(
|
|
93
|
+
/** 键盘高度变化事件的回调函数 */
|
|
94
|
+
callback?: onKeyboardHeightChange.Callback
|
|
95
|
+
): void
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace onMemoryWarning {
|
|
5
|
+
/** 内存不足告警事件的回调函数 */
|
|
6
|
+
type Callback = (
|
|
7
|
+
result: CallbackResult,
|
|
8
|
+
) => void
|
|
9
|
+
|
|
10
|
+
interface CallbackResult {
|
|
11
|
+
/** 内存告警等级,只有 Android 才有,对应系统宏定义 */
|
|
12
|
+
level: keyof Level
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Level {
|
|
16
|
+
/** TRIM_MEMORY_RUNNING_MODERATE */
|
|
17
|
+
5
|
|
18
|
+
/** TRIM_MEMORY_RUNNING_LOW */
|
|
19
|
+
10
|
|
20
|
+
/** TRIM_MEMORY_RUNNING_CRITICAL */
|
|
21
|
+
15
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface TaroStatic {
|
|
26
|
+
/** 监听内存不足告警事件。
|
|
27
|
+
*
|
|
28
|
+
* 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
|
|
29
|
+
* @supported weapp, alipay, swan, jd, tt, harmony
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* Taro.onMemoryWarning(function () {
|
|
33
|
+
* console.log('onMemoryWarningReceive')
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.onMemoryWarning.html
|
|
37
|
+
*/
|
|
38
|
+
onMemoryWarning(
|
|
39
|
+
/** 内存不足告警事件的回调函数 */
|
|
40
|
+
callback: onMemoryWarning.Callback,
|
|
41
|
+
): void
|
|
42
|
+
|
|
43
|
+
/** 取消监听内存不足告警事件。
|
|
44
|
+
* @supported weapp, alipay, swan, harmony
|
|
45
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html
|
|
46
|
+
*/
|
|
47
|
+
offMemoryWarning(
|
|
48
|
+
/** 取消监听内存不足告警事件 */
|
|
49
|
+
callback?: onMemoryWarning.Callback,
|
|
50
|
+
): void
|
|
51
|
+
}
|
|
52
|
+
}
|