@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.
Files changed (140) hide show
  1. package/README.md +12 -0
  2. package/dist/index.js +147 -0
  3. package/dist/index.js.map +1 -0
  4. package/index.js +9 -0
  5. package/package.json +86 -0
  6. package/types/api/ad/index.d.ts +197 -0
  7. package/types/api/ai/face.d.ts +133 -0
  8. package/types/api/ai/inference.d.ts +129 -0
  9. package/types/api/ai/visionkit.d.ts +874 -0
  10. package/types/api/alipay/index.d.ts +69 -0
  11. package/types/api/base/crypto.d.ts +104 -0
  12. package/types/api/base/debug.d.ts +329 -0
  13. package/types/api/base/env.d.ts +19 -0
  14. package/types/api/base/index.d.ts +102 -0
  15. package/types/api/base/performance.d.ts +258 -0
  16. package/types/api/base/system.d.ts +742 -0
  17. package/types/api/base/update.d.ts +130 -0
  18. package/types/api/base/weapp/app-event.d.ts +265 -0
  19. package/types/api/base/weapp/life-cycle.d.ts +155 -0
  20. package/types/api/canvas/index.d.ts +2162 -0
  21. package/types/api/cloud/index.d.ts +2622 -0
  22. package/types/api/data-analysis/index.d.ts +122 -0
  23. package/types/api/device/accelerometer.d.ts +102 -0
  24. package/types/api/device/accessibility.d.ts +26 -0
  25. package/types/api/device/battery.d.ts +46 -0
  26. package/types/api/device/bluetooth-ble.d.ts +601 -0
  27. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  28. package/types/api/device/bluetooth.d.ts +463 -0
  29. package/types/api/device/calendar.d.ts +98 -0
  30. package/types/api/device/clipboard.d.ts +81 -0
  31. package/types/api/device/compass.d.ts +105 -0
  32. package/types/api/device/contact.d.ts +110 -0
  33. package/types/api/device/gyroscope.d.ts +85 -0
  34. package/types/api/device/iBeacon.d.ts +168 -0
  35. package/types/api/device/keyboard.d.ts +97 -0
  36. package/types/api/device/memory.d.ts +52 -0
  37. package/types/api/device/motion.d.ts +88 -0
  38. package/types/api/device/network.d.ts +172 -0
  39. package/types/api/device/nfc.d.ts +1238 -0
  40. package/types/api/device/phone.d.ts +30 -0
  41. package/types/api/device/scan.d.ts +111 -0
  42. package/types/api/device/screen.d.ts +217 -0
  43. package/types/api/device/sms.d.ts +26 -0
  44. package/types/api/device/vibrate.d.ts +51 -0
  45. package/types/api/device/wifi.d.ts +301 -0
  46. package/types/api/ext/index.d.ts +64 -0
  47. package/types/api/files/index.d.ts +1472 -0
  48. package/types/api/framework/index.d.ts +51 -0
  49. package/types/api/location/index.d.ts +517 -0
  50. package/types/api/media/audio.d.ts +1013 -0
  51. package/types/api/media/background-audio.d.ts +291 -0
  52. package/types/api/media/camera.d.ts +207 -0
  53. package/types/api/media/editor.d.ts +239 -0
  54. package/types/api/media/image.d.ts +469 -0
  55. package/types/api/media/live.d.ts +461 -0
  56. package/types/api/media/map.d.ts +638 -0
  57. package/types/api/media/media-recorder.d.ts +117 -0
  58. package/types/api/media/recorder.d.ts +317 -0
  59. package/types/api/media/video-decoder.d.ts +117 -0
  60. package/types/api/media/video-processing.d.ts +84 -0
  61. package/types/api/media/video.d.ts +527 -0
  62. package/types/api/media/voip.d.ts +393 -0
  63. package/types/api/navigate/index.d.ts +327 -0
  64. package/types/api/network/download.d.ts +173 -0
  65. package/types/api/network/mdns.d.ts +191 -0
  66. package/types/api/network/request.d.ts +480 -0
  67. package/types/api/network/tcp.d.ts +181 -0
  68. package/types/api/network/udp.d.ts +218 -0
  69. package/types/api/network/upload.d.ts +201 -0
  70. package/types/api/network/websocket.d.ts +383 -0
  71. package/types/api/open-api/account.d.ts +51 -0
  72. package/types/api/open-api/address.d.ts +68 -0
  73. package/types/api/open-api/authorize.d.ts +80 -0
  74. package/types/api/open-api/card.d.ts +110 -0
  75. package/types/api/open-api/channels.d.ts +225 -0
  76. package/types/api/open-api/customer-service.d.ts +45 -0
  77. package/types/api/open-api/device-voip.d.ts +103 -0
  78. package/types/api/open-api/facial.d.ts +98 -0
  79. package/types/api/open-api/favorites.d.ts +101 -0
  80. package/types/api/open-api/group.d.ts +59 -0
  81. package/types/api/open-api/invoice.d.ts +87 -0
  82. package/types/api/open-api/license-plate.d.ts +27 -0
  83. package/types/api/open-api/login.d.ts +115 -0
  84. package/types/api/open-api/my-miniprogram.d.ts +28 -0
  85. package/types/api/open-api/privacy.d.ts +107 -0
  86. package/types/api/open-api/redpackage.d.ts +24 -0
  87. package/types/api/open-api/settings.d.ts +174 -0
  88. package/types/api/open-api/soter.d.ts +184 -0
  89. package/types/api/open-api/sticker.d.ts +83 -0
  90. package/types/api/open-api/subscribe-message.d.ts +305 -0
  91. package/types/api/open-api/user-info.d.ts +182 -0
  92. package/types/api/open-api/werun.d.ts +101 -0
  93. package/types/api/payment/index.d.ts +119 -0
  94. package/types/api/qq/index.d.ts +354 -0
  95. package/types/api/route/index.d.ts +324 -0
  96. package/types/api/share/index.d.ts +354 -0
  97. package/types/api/skyline/index.d.ts +345 -0
  98. package/types/api/storage/background-fetch.d.ts +131 -0
  99. package/types/api/storage/cache-manager.d.ts +249 -0
  100. package/types/api/storage/index.d.ts +405 -0
  101. package/types/api/swan/bookshelf.d.ts +307 -0
  102. package/types/api/swan/download-package.d.ts +80 -0
  103. package/types/api/swan/index.d.ts +251 -0
  104. package/types/api/swan/pay.d.ts +139 -0
  105. package/types/api/taro.extend.d.ts +233 -0
  106. package/types/api/taro.hooks.d.ts +148 -0
  107. package/types/api/ui/animation.d.ts +427 -0
  108. package/types/api/ui/background.d.ts +69 -0
  109. package/types/api/ui/custom-component.d.ts +23 -0
  110. package/types/api/ui/fonts.d.ts +77 -0
  111. package/types/api/ui/interaction.d.ts +281 -0
  112. package/types/api/ui/menu.d.ts +29 -0
  113. package/types/api/ui/navigation-bar.d.ts +130 -0
  114. package/types/api/ui/pull-down-refresh.d.ts +50 -0
  115. package/types/api/ui/scroll.d.ts +114 -0
  116. package/types/api/ui/sticky.d.ts +32 -0
  117. package/types/api/ui/tab-bar.d.ts +196 -0
  118. package/types/api/ui/window.d.ts +71 -0
  119. package/types/api/worker/index.d.ts +83 -0
  120. package/types/api/wxml/index.d.ts +540 -0
  121. package/types/compile/compiler.d.ts +32 -0
  122. package/types/compile/config/h5.d.ts +134 -0
  123. package/types/compile/config/harmony.d.ts +118 -0
  124. package/types/compile/config/index.d.ts +8 -0
  125. package/types/compile/config/manifest.d.ts +155 -0
  126. package/types/compile/config/mini.d.ts +118 -0
  127. package/types/compile/config/plugin.d.ts +34 -0
  128. package/types/compile/config/project.d.ts +338 -0
  129. package/types/compile/config/rn.d.ts +85 -0
  130. package/types/compile/config/util.d.ts +179 -0
  131. package/types/compile/hooks.d.ts +13 -0
  132. package/types/compile/index.d.ts +11 -0
  133. package/types/compile/viteCompilerContext.d.ts +167 -0
  134. package/types/global.d.ts +428 -0
  135. package/types/index.d.ts +190 -0
  136. package/types/taro.api.d.ts +130 -0
  137. package/types/taro.component.d.ts +168 -0
  138. package/types/taro.config.d.ts +712 -0
  139. package/types/taro.lifecycle.d.ts +220 -0
  140. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,463 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace stopBluetoothDevicesDiscovery {
5
+ interface Promised extends TaroGeneral.CallbackResult {
6
+ /** 成功:ok,错误:详细信息 */
7
+ errMsg: string
8
+ }
9
+ interface Option {
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.BluetoothError) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.BluetoothError) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: TaroGeneral.BluetoothError) => void
16
+ }
17
+ }
18
+
19
+ namespace startBluetoothDevicesDiscovery {
20
+ interface Promised extends TaroGeneral.CallbackResult {
21
+ /** 成功:ok,错误:详细信息 */
22
+ errMsg: string
23
+ }
24
+ interface Option {
25
+ /** 是否允许重复上报同一设备。如果允许重复上报,则 Taro.onBlueToothDeviceFound 方法会多次上报同一设备,但是 RSSI 值会有不同。 */
26
+ allowDuplicatesKey?: boolean
27
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
+ complete?: (res: TaroGeneral.BluetoothError) => void
29
+ /** 接口调用失败的回调函数 */
30
+ fail?: (res: TaroGeneral.BluetoothError) => void
31
+ /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */
32
+ interval?: number
33
+ /** 要搜索的蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
34
+ services?: string[]
35
+ /** 扫描模式,越高扫描越快,也越耗电。仅安卓微信客户端 7.0.12 及以上支持。 */
36
+ powerLevel?: keyof PowerLevel
37
+ /** 接口调用成功的回调函数 */
38
+ success?: (res: TaroGeneral.BluetoothError) => void
39
+ }
40
+
41
+ interface PowerLevel {
42
+ /** 低 */
43
+ low,
44
+ /** 中 */
45
+ medium,
46
+ /** 高 */
47
+ high
48
+ }
49
+ }
50
+
51
+ namespace openBluetoothAdapter {
52
+ interface Option {
53
+ /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。 */
54
+ mode?: keyof Mode;
55
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
56
+ complete?: (res: TaroGeneral.BluetoothError) => void
57
+ /** 接口调用失败的回调函数 */
58
+ fail?: (res: TaroGeneral.BluetoothError) => void
59
+ /** 接口调用成功的回调函数 */
60
+ success?: (res: TaroGeneral.BluetoothError) => void
61
+ }
62
+
63
+ interface Mode {
64
+ /** 主机模式 */
65
+ central
66
+ /** 从机(外围设备)模式 */
67
+ peripheral
68
+ }
69
+
70
+ /** object.fail 回调函数返回的 state 参数(仅 iOS) */
71
+ interface state {
72
+ /** 未知 */
73
+ 0
74
+ /** 重置中 */
75
+ 1
76
+ /** 不支持 */
77
+ 2
78
+ /** 未授权 */
79
+ 3
80
+ /** 未开启 */
81
+ 4
82
+ }
83
+ }
84
+
85
+ namespace onBluetoothDeviceFound {
86
+ /** 寻找到新设备的事件的回调函数 */
87
+ type Callback = (
88
+ result: CallbackResult,
89
+ ) => void
90
+ interface CallbackResult {
91
+ /** 新搜索到的设备列表 */
92
+ devices: CallbackResultBlueToothDevice[]
93
+ }
94
+ /** 新搜索到的设备 */
95
+ interface CallbackResultBlueToothDevice {
96
+ /** 当前蓝牙设备的信号强度,单位 dBm */
97
+ RSSI: number
98
+ /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
99
+ advertisData: ArrayBuffer
100
+ /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */
101
+ advertisServiceUUIDs: string[]
102
+ /** 用于区分设备的 id */
103
+ deviceId: string
104
+ /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */
105
+ localName: string
106
+ /** 蓝牙设备名称,某些设备可能没有 */
107
+ name: string
108
+ /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
109
+ serviceData: TaroGeneral.IAnyObject
110
+ /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
111
+ connectable?: boolean
112
+ }
113
+ }
114
+
115
+ namespace onBluetoothAdapterStateChange {
116
+ /** 蓝牙适配器状态变化事件的回调函数 */
117
+ type Callback = (
118
+ result: CallbackResult,
119
+ ) => void
120
+ interface CallbackResult {
121
+ /** 蓝牙适配器是否可用 */
122
+ available: boolean
123
+ /** 蓝牙适配器是否处于搜索状态 */
124
+ discovering: boolean
125
+ }
126
+ }
127
+
128
+ namespace makeBluetoothPair {
129
+ interface Option {
130
+ /** 蓝牙设备 id */
131
+ deviceId: string
132
+ /** pin 码,Base64 格式 */
133
+ pin: string
134
+ /** 超时时间,单位 ms
135
+ * @default 20000
136
+ */
137
+ timeout?: string
138
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
139
+ complete?: (res: TaroGeneral.CallbackResult) => void
140
+ /** 接口调用失败的回调函数 */
141
+ fail?: (res: TaroGeneral.CallbackResult) => void
142
+ /** 接口调用成功的回调函数 */
143
+ success?: (res: TaroGeneral.CallbackResult) => void
144
+ }
145
+ }
146
+
147
+ namespace isBluetoothDevicePaired {
148
+ interface Option {
149
+ /** 蓝牙设备 id */
150
+ deviceId: string
151
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
152
+ complete?: (res: TaroGeneral.CallbackResult) => void
153
+ /** 接口调用失败的回调函数 */
154
+ fail?: (res: TaroGeneral.CallbackResult) => void
155
+ /** 接口调用成功的回调函数 */
156
+ success?: (res: TaroGeneral.CallbackResult) => void
157
+
158
+ }
159
+ }
160
+
161
+ namespace getConnectedBluetoothDevices {
162
+ interface Option {
163
+ /** 蓝牙设备主 service 的 uuid 列表 */
164
+ services: string[]
165
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
166
+ complete?: (res: TaroGeneral.BluetoothError) => void
167
+ /** 接口调用失败的回调函数 */
168
+ fail?: (res: TaroGeneral.BluetoothError) => void
169
+ /** 接口调用成功的回调函数 */
170
+ success?: (result: SuccessCallbackResult) => void
171
+ }
172
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
173
+ /** 搜索到的设备列表 */
174
+ devices: BluetoothDeviceInfo[]
175
+ /** 成功:ok,错误:详细信息 */
176
+ errMsg: string
177
+ }
178
+ /** 搜索到的设备 */
179
+ interface BluetoothDeviceInfo {
180
+ /** 用于区分设备的 id */
181
+ deviceId: string
182
+ /** 蓝牙设备名称,某些设备可能没有 */
183
+ name: string
184
+ }
185
+ }
186
+
187
+ namespace getBluetoothDevices {
188
+ interface Option {
189
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
190
+ complete?: (res: TaroGeneral.BluetoothError) => void
191
+ /** 接口调用失败的回调函数 */
192
+ fail?: (res: TaroGeneral.BluetoothError) => void
193
+ /** 接口调用成功的回调函数 */
194
+ success?: (res: SuccessCallbackResult) => void
195
+ }
196
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
197
+ /** uuid 对应的的已连接设备列表 */
198
+ devices: SuccessCallbackResultBlueToothDevice[]
199
+ /** 成功:ok,错误:详细信息 */
200
+ errMsg: string
201
+ }
202
+ /** uuid 对应的的已连接设备列表 */
203
+ interface SuccessCallbackResultBlueToothDevice extends TaroGeneral.CallbackResult {
204
+ /** 当前蓝牙设备的信号强度 */
205
+ RSSI: number
206
+ /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
207
+ advertisData: ArrayBuffer
208
+ /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */
209
+ advertisServiceUUIDs: string[]
210
+ /** 用于区分设备的 id */
211
+ deviceId: string
212
+ /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */
213
+ localName: string
214
+ /** 蓝牙设备名称,某些设备可能没有 */
215
+ name: string
216
+ /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
217
+ serviceData: TaroGeneral.IAnyObject
218
+ /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
219
+ connectable?: boolean
220
+ }
221
+ }
222
+
223
+ namespace getBluetoothAdapterState {
224
+ interface Option {
225
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
226
+ complete?: (res: TaroGeneral.BluetoothError) => void
227
+ /** 接口调用失败的回调函数 */
228
+ fail?: (res: TaroGeneral.BluetoothError) => void
229
+ /** 接口调用成功的回调函数 */
230
+ success?: (result: SuccessCallbackResult) => void
231
+ }
232
+
233
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
234
+ /** 蓝牙适配器是否可用 */
235
+ available: boolean
236
+ /** 是否正在搜索设备 */
237
+ discovering: boolean
238
+ /** 成功:ok,错误:详细信息 */
239
+ errMsg: string
240
+ }
241
+ }
242
+
243
+ namespace closeBluetoothAdapter {
244
+ interface Option {
245
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
246
+ complete?: (res: TaroGeneral.BluetoothError) => void
247
+ /** 接口调用失败的回调函数 */
248
+ fail?: (res: TaroGeneral.BluetoothError) => void
249
+ /** 接口调用成功的回调函数 */
250
+ success?: (res: TaroGeneral.BluetoothError) => void
251
+ }
252
+ }
253
+
254
+ interface TaroStatic {
255
+ /** 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
256
+ * @supported weapp, alipay, jd
257
+ * @example
258
+ * ```tsx
259
+ * Taro.stopBluetoothDevicesDiscovery({
260
+ * success: function (res) {
261
+ * console.log(res)
262
+ * }
263
+ * })
264
+ * ```
265
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html
266
+ */
267
+ stopBluetoothDevicesDiscovery(
268
+ option?: stopBluetoothDevicesDiscovery.Option,
269
+ ): Promise<stopBluetoothDevicesDiscovery.Promised>
270
+
271
+ /** 开始搜寻附近的蓝牙外围设备。**此操作比较耗费系统资源,请在搜索并连接到设备后调用 Taro.stopBluetoothDevicesDiscovery 方法停止搜索。**
272
+ * @supported weapp, alipay, jd
273
+ * @example
274
+ * ```tsx
275
+ * // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
276
+ * Taro.startBluetoothDevicesDiscovery({
277
+ * services: ['FEE7'],
278
+ * success: function (res) {
279
+ * console.log(res)
280
+ * }
281
+ * })
282
+ * ```
283
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html
284
+ */
285
+ startBluetoothDevicesDiscovery(
286
+ option: startBluetoothDevicesDiscovery.Option,
287
+ ): Promise<startBluetoothDevicesDiscovery.Promised>
288
+
289
+ /** 初始化蓝牙模块
290
+ *
291
+ * **注意**
292
+ * - 其他蓝牙相关 API 必须在 Taro.openBluetoothAdapter 调用之后使用。否则 API 会返回错误(errCode=10000)。
293
+ * - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 Taro.openBluetoothAdapter 监听手机蓝牙状态的改变,也可以调用蓝牙模块的所有API。
294
+ * @supported weapp, alipay, jd
295
+ * @example
296
+ * ```tsx
297
+ * Taro.openBluetoothAdapter({
298
+ * success: function (res) {
299
+ * console.log(res)
300
+ * }
301
+ * })
302
+ * ```
303
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html
304
+ */
305
+ openBluetoothAdapter(option?: openBluetoothAdapter.Option): Promise<TaroGeneral.CallbackResult>
306
+
307
+ /** 监听寻找到新设备的事件
308
+ *
309
+ * **注意**
310
+ * - 若在 Taro.onBluetoothDeviceFound 回调了某个设备,则此设备会添加到 Taro.getBluetoothDevices 接口获取到的数组中。
311
+ * - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限
312
+ * @supported weapp, alipay, jd
313
+ * @example
314
+ * ```tsx
315
+ * // ArrayBuffer转16进度字符串示例
316
+ * function ab2hex(buffer) {
317
+ * var hexArr = Array.prototype.map.call(
318
+ * new Uint8Array(buffer),
319
+ * function(bit) {
320
+ * return ('00' + bit.toString(16)).slice(-2)
321
+ * }
322
+ * )
323
+ * return hexArr.join('');
324
+ * }
325
+ * Taro.onBluetoothDeviceFound(function (res) {
326
+ * var devices = res.devices;
327
+ * console.log('new device list has founded')
328
+ * console.dir(devices)
329
+ * console.log(ab2hex(devices[0].advertisData))
330
+ * })
331
+ * ```
332
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html
333
+ */
334
+ onBluetoothDeviceFound(
335
+ /** 寻找到新设备的事件的回调函数 */
336
+ callback: onBluetoothDeviceFound.Callback,
337
+ ): void
338
+
339
+ /** 监听蓝牙适配器状态变化事件
340
+ * @supported weapp, alipay, jd
341
+ * @example
342
+ * ```tsx
343
+ * Taro.onBluetoothAdapterStateChange(function (res) {
344
+ * console.log('adapterState changed, now is', res)
345
+ * })
346
+ * ```
347
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html
348
+ */
349
+ onBluetoothAdapterStateChange(
350
+ /** 蓝牙适配器状态变化事件的回调函数 */
351
+ callback: onBluetoothAdapterStateChange.Callback,
352
+ ): void
353
+
354
+ /** 取消监听寻找到新设备的事件
355
+ * @supported weapp, alipay
356
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html
357
+ */
358
+ offBluetoothDeviceFound(
359
+ /** 寻找到新设备的事件的回调函数 */
360
+ callback: onBluetoothDeviceFound.Callback,
361
+ ): void
362
+
363
+ /** 取消监听蓝牙适配器状态变化事件
364
+ * @supported weapp, alipay
365
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html
366
+ */
367
+ offBluetoothAdapterStateChange(
368
+ /** 蓝牙适配器状态变化事件的回调函数 */
369
+ callback: onBluetoothAdapterStateChange.Callback,
370
+ ): void
371
+
372
+ /** 蓝牙配对接口,仅安卓支持
373
+ *
374
+ * 通常情况下(需要指定 pin 码或者密码时)系统会接管配对流程,直接调用 [Taro.createBLEConnection](/docs/apis/device/bluetooth-ble/createBLEConnection) 即可。该接口只应当在开发者不想让用户手动输入 pin 码且真机验证确认可以正常生效情况下用。
375
+ * @supported weapp
376
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.makeBluetoothPair.html
377
+ */
378
+ makeBluetoothPair(option: makeBluetoothPair.Option): Promise<TaroGeneral.CallbackResult>
379
+
380
+ /** 查询蓝牙设备是否配对,仅安卓支持
381
+ * @supported weapp
382
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.isBluetoothDevicePaired.html
383
+ */
384
+ isBluetoothDevicePaired(option: isBluetoothDevicePaired.Option): Promise<TaroGeneral.CallbackResult>
385
+
386
+ /** 根据 uuid 获取处于已连接状态的设备。
387
+ * @supported weapp, alipay, jd
388
+ * @example
389
+ * ```tsx
390
+ * Taro.getConnectedBluetoothDevices({
391
+ * success: function (res) {
392
+ * console.log(res)
393
+ * }
394
+ * })
395
+ * ```
396
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html
397
+ */
398
+ getConnectedBluetoothDevices(
399
+ option: getConnectedBluetoothDevices.Option,
400
+ ): Promise<getConnectedBluetoothDevices.SuccessCallbackResult>
401
+
402
+ /** 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。
403
+ *
404
+ * **注意事项**
405
+ * - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 Taro.closeBluetoothAdapter 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。
406
+ * - 蓝牙设备在被搜索到时,系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 name 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
407
+ * @supported weapp, alipay, jd
408
+ * @example
409
+ * ```tsx
410
+ * // ArrayBuffer转16进度字符串示例
411
+ * function ab2hex(buffer) {
412
+ * var hexArr = Array.prototype.map.call(
413
+ * new Uint8Array(buffer),
414
+ * function(bit) {
415
+ * return ('00' + bit.toString(16)).slice(-2)
416
+ * }
417
+ * )
418
+ * return hexArr.join('');
419
+ * }
420
+ * Taro.getBluetoothDevices({
421
+ * success: function (res) {
422
+ * console.log(res)
423
+ * if (res.devices[0]) {
424
+ * console.log(ab2hex(res.devices[0].advertisData))
425
+ * }
426
+ * }
427
+ * })
428
+ * ```
429
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html
430
+ */
431
+ getBluetoothDevices(option?: getBluetoothDevices.Option): Promise<getBluetoothDevices.SuccessCallbackResult>
432
+
433
+ /** 获取本机蓝牙适配器状态。
434
+ * @supported weapp, alipay, jd
435
+ * @example
436
+ * ```tsx
437
+ * Taro.getBluetoothAdapterState({
438
+ * success: function (res) {
439
+ * console.log(res)
440
+ * }
441
+ * })
442
+ * ```
443
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html
444
+ */
445
+ getBluetoothAdapterState(
446
+ option?: getBluetoothAdapterState.Option,
447
+ ): Promise<getBluetoothAdapterState.SuccessCallbackResult>
448
+
449
+ /** 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 Taro.openBluetoothAdapter 成对调用。
450
+ * @supported weapp, alipay, jd
451
+ * @example
452
+ * ```tsx
453
+ * Taro.closeBluetoothAdapter({
454
+ * success: function (res) {
455
+ * console.log(res)
456
+ * }
457
+ * })
458
+ * ```
459
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html
460
+ */
461
+ closeBluetoothAdapter(option?: closeBluetoothAdapter.Option): Promise<TaroGeneral.CallbackResult>
462
+ }
463
+ }
@@ -0,0 +1,98 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace addPhoneRepeatCalendar {
5
+ interface Option {
6
+ /** 日历事件标题 */
7
+ title: string
8
+ /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
9
+ startTime: number
10
+ /** 是否全天事件
11
+ * @default false
12
+ */
13
+ allDay?: boolean
14
+ /** 事件说明 */
15
+ description?: string
16
+ /** 事件位置 */
17
+ location?: string
18
+ /** 结束时间的 unix 时间戳,默认与开始时间相同 */
19
+ endTime?: string
20
+ /** 是否提醒
21
+ * @default true
22
+ */
23
+ alarm?: boolean
24
+ /** 提醒提前量,单位秒,默认 0 表示开始时提醒
25
+ * @default 0
26
+ */
27
+ alarmOffset?: number
28
+ /** 重复周期,默认 month 每月重复
29
+ * @default "month"
30
+ */
31
+ repeatInterval?: keyof RepeatInterval
32
+ /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
33
+ repeatEndTime?: number
34
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
35
+ complete?: (res: TaroGeneral.CallbackResult) => void
36
+ /** 接口调用失败的回调函数 */
37
+ fail?: (res: TaroGeneral.CallbackResult) => void
38
+ /** 接口调用成功的回调函数 */
39
+ success?: (result: TaroGeneral.CallbackResult) => void
40
+ }
41
+ interface RepeatInterval {
42
+ /** 每天重复 */
43
+ day
44
+ /** 每周重复 */
45
+ week
46
+ /** 每月重复。该模式日期不能大于 28 日 */
47
+ month
48
+ /** 每年重复 */
49
+ year
50
+ }
51
+ }
52
+
53
+ namespace addPhoneCalendar {
54
+ interface Option {
55
+ /** 日历事件标题 */
56
+ title: string
57
+ /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
58
+ startTime: number
59
+ /** 是否全天事件
60
+ * @default false
61
+ */
62
+ allDay?: boolean
63
+ /** 事件说明 */
64
+ description?: string
65
+ /** 事件位置 */
66
+ location?: string
67
+ /** 结束时间的 unix 时间戳,默认与开始时间相同 */
68
+ endTime?: string
69
+ /** 是否提醒
70
+ * @default true
71
+ */
72
+ alarm?: boolean
73
+ /** 提醒提前量,单位秒,默认 0 表示开始时提醒
74
+ * @default 0
75
+ */
76
+ alarmOffset?: number
77
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
78
+ complete?: (res: TaroGeneral.CallbackResult) => void
79
+ /** 接口调用失败的回调函数 */
80
+ fail?: (res: TaroGeneral.CallbackResult) => void
81
+ /** 接口调用成功的回调函数 */
82
+ success?: (res: TaroGeneral.CallbackResult) => void
83
+ }
84
+ }
85
+
86
+ interface TaroStatic {
87
+ /** 向系统日历添加重复事件
88
+ * @supported weapp, h5
89
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html
90
+ */
91
+ addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
92
+ /** 向系统日历添加事件
93
+ * @supported weapp, tt, h5
94
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html
95
+ */
96
+ addPhoneCalendar(option: addPhoneCalendar.Option): Promise<TaroGeneral.CallbackResult>
97
+ }
98
+ }
@@ -0,0 +1,81 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace setClipboardData {
5
+ interface Promised extends TaroGeneral.CallbackResult {
6
+ /** 调用信息 */
7
+ errMsg: string
8
+ /** 剪贴板的内容 */
9
+ data: string
10
+ }
11
+ interface Option {
12
+ /** 剪贴板的内容 */
13
+ data: string
14
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
15
+ complete?: (res: TaroGeneral.CallbackResult) => void
16
+ /** 接口调用失败的回调函数 */
17
+ fail?: (res: TaroGeneral.CallbackResult) => void
18
+ /** 接口调用成功的回调函数 */
19
+ success?: (res: TaroGeneral.CallbackResult) => void
20
+ }
21
+ }
22
+
23
+ namespace getClipboardData {
24
+ interface Promised extends TaroGeneral.CallbackResult {
25
+ /** 调用信息 */
26
+ errMsg: string
27
+ /** 剪贴板的内容 */
28
+ data: string
29
+ }
30
+ interface Option {
31
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
32
+ complete?: (res: TaroGeneral.CallbackResult) => void
33
+ /** 接口调用失败的回调函数 */
34
+ fail?: (res: TaroGeneral.CallbackResult) => void
35
+ /** 接口调用成功的回调函数 */
36
+ success?: (res: SuccessCallbackOption) => void
37
+ }
38
+ interface SuccessCallbackOption {
39
+ /** 剪贴板的内容 */
40
+ data: string
41
+ }
42
+ }
43
+
44
+ interface TaroStatic {
45
+ /** 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
46
+ * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
47
+ * @h5 部分实现
48
+ * @example
49
+ * ```tsx
50
+ * Taro.setClipboardData({
51
+ * data: 'data',
52
+ * success: function (res) {
53
+ * Taro.getClipboardData({
54
+ * success: function (res) {
55
+ * console.log(res.data) // data
56
+ * }
57
+ * })
58
+ * }
59
+ * })
60
+ * ```
61
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html
62
+ */
63
+ setClipboardData(option: setClipboardData.Option): Promise<setClipboardData.Promised>
64
+
65
+ /**
66
+ * 获取系统剪贴板内容
67
+ * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
68
+ * @h5 部分实现
69
+ * @example
70
+ * ```tsx
71
+ * Taro.getClipboardData({
72
+ * success: function (res){
73
+ * console.log(res.data)
74
+ * }
75
+ * })
76
+ * ```
77
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html
78
+ */
79
+ getClipboardData(res?: getClipboardData.Option): Promise<getClipboardData.Promised>
80
+ }
81
+ }