@tarojs/taro 3.5.0-canary.1 → 3.5.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/html.css +50 -14
- package/html5.css +167 -64
- package/index.js +3 -4
- package/package.json +21 -11
- package/types/api/ad/index.d.ts +2 -2
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +11 -3
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +541 -103
- package/types/api/base/update.d.ts +60 -8
- package/types/api/base/weapp/app-event.d.ts +99 -37
- package/types/api/base/weapp/life-cycle.d.ts +142 -2
- package/types/api/canvas/index.d.ts +151 -137
- package/types/api/cloud/index.d.ts +17 -2
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +6 -6
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/compass.d.ts +3 -3
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +6 -6
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +1 -1
- package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +56 -15
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +42 -14
- package/types/api/device/vibrate.d.ts +6 -2
- package/types/api/device/wifi.d.ts +44 -9
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +392 -205
- package/types/api/framework/index.d.ts +5 -4
- package/types/api/location/index.d.ts +156 -53
- package/types/api/media/audio.d.ts +629 -38
- package/types/api/media/background-audio.d.ts +9 -9
- package/types/api/media/camera.d.ts +41 -22
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +64 -35
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +474 -54
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +21 -21
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +47 -18
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
- package/types/api/network/download.d.ts +61 -19
- package/types/api/network/request.d.ts +129 -41
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +55 -28
- package/types/api/network/websocket.d.ts +20 -19
- package/types/api/open-api/address.d.ts +1 -1
- package/types/api/open-api/authorize.d.ts +42 -3
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +82 -17
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +89 -4
- package/types/api/open-api/user-info.d.ts +56 -19
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +18 -14
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +38 -92
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +105 -155
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +6 -5
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +75 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +116 -112
- package/types/compile.d.ts +57 -6
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/taro.component.d.ts +21 -65
- package/types/taro.config.d.ts +31 -0
- package/types/taro.extend.d.ts +31 -18
- package/types/taro.hooks.d.ts +55 -3
- package/types/taro.lifecycle.d.ts +21 -14
- package/LICENSE +0 -21
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -3,9 +3,9 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace canvasToTempFilePath {
|
|
5
5
|
interface Option {
|
|
6
|
-
/** 画布标识,传入 [canvas](
|
|
7
|
-
canvas?:
|
|
8
|
-
/** 画布标识,传入 [canvas](
|
|
6
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
|
|
7
|
+
canvas?: Canvas
|
|
8
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id */
|
|
9
9
|
canvasId?: string
|
|
10
10
|
/** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
|
|
11
11
|
quality?: number
|
|
@@ -20,7 +20,7 @@ declare module '../../index' {
|
|
|
20
20
|
/** 目标文件的类型
|
|
21
21
|
* @default "png"
|
|
22
22
|
*/
|
|
23
|
-
fileType?: keyof
|
|
23
|
+
fileType?: keyof FileType
|
|
24
24
|
/** 指定的画布区域的高度 */
|
|
25
25
|
height?: number
|
|
26
26
|
/** 接口调用成功的回调函数 */
|
|
@@ -38,7 +38,7 @@ declare module '../../index' {
|
|
|
38
38
|
/** 调用结果 */
|
|
39
39
|
errMsg: string
|
|
40
40
|
}
|
|
41
|
-
interface
|
|
41
|
+
interface FileType {
|
|
42
42
|
/** jpg 图片 */
|
|
43
43
|
jpg
|
|
44
44
|
/** png 图片 */
|
|
@@ -75,7 +75,7 @@ declare module '../../index' {
|
|
|
75
75
|
}
|
|
76
76
|
namespace canvasPutImageData {
|
|
77
77
|
interface Option {
|
|
78
|
-
/** 画布标识,传入 [canvas](
|
|
78
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id 属性。 */
|
|
79
79
|
canvasId: string
|
|
80
80
|
/** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
|
|
81
81
|
data: Uint8ClampedArray
|
|
@@ -97,7 +97,7 @@ declare module '../../index' {
|
|
|
97
97
|
}
|
|
98
98
|
namespace canvasGetImageData {
|
|
99
99
|
interface Option {
|
|
100
|
-
/** 画布标识,传入 [canvas](
|
|
100
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 `canvas-id` 属性。 */
|
|
101
101
|
canvasId: string
|
|
102
102
|
/** 将要被提取的图像数据矩形区域的高度 */
|
|
103
103
|
height: number
|
|
@@ -126,11 +126,6 @@ declare module '../../index' {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
/** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。
|
|
130
|
-
* @supported weapp
|
|
131
|
-
*/
|
|
132
|
-
interface Path2D {}
|
|
133
|
-
|
|
134
129
|
/** Canvas 实例,可通过 SelectorQuery 获取。
|
|
135
130
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html
|
|
136
131
|
*/
|
|
@@ -190,10 +185,42 @@ declare module '../../index' {
|
|
|
190
185
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html
|
|
191
186
|
*/
|
|
192
187
|
interface CanvasContext {
|
|
188
|
+
/** 填充颜色。用法同 [CanvasContext.setFillStyle()]。 */
|
|
189
|
+
fillStyle: string
|
|
190
|
+
/** 边框颜色。用法同 [CanvasContext.setFillStyle()]。 */
|
|
191
|
+
strokeStyle: string
|
|
192
|
+
/** 阴影相对于形状在水平方向的偏移 */
|
|
193
|
+
shadowOffsetX: number
|
|
194
|
+
/** 阴影相对于形状在竖直方向的偏移 */
|
|
195
|
+
shadowOffsetY: number
|
|
196
|
+
/** 阴影的模糊级别 */
|
|
197
|
+
shadowBlur: number
|
|
198
|
+
/** 阴影的颜色 */
|
|
199
|
+
shadowColor: string
|
|
200
|
+
/** 线条的宽度。用法同 [CanvasContext.setLineWidth()]。 */
|
|
201
|
+
lineWidth: number
|
|
202
|
+
/** 线条的端点样式。用法同 [CanvasContext.setLineCap()]。 */
|
|
203
|
+
lineCap: keyof CanvasContext.LineCap
|
|
204
|
+
/** 线条的交点样式。用法同 [CanvasContext.setLineJoin()]。 */
|
|
205
|
+
lineJoin: keyof CanvasContext.LineJoin
|
|
206
|
+
/** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()]。 */
|
|
207
|
+
miterLimit: number
|
|
208
|
+
/** 虚线偏移量,初始值为0 */
|
|
209
|
+
lineDashOffset: number
|
|
210
|
+
/** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 */
|
|
211
|
+
font: string
|
|
212
|
+
/** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
|
|
213
|
+
globalAlpha: number
|
|
214
|
+
/** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
|
|
215
|
+
*
|
|
216
|
+
* 目前支持的操作有
|
|
217
|
+
* - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
|
|
218
|
+
* - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity */
|
|
219
|
+
globalCompositeOperation: string
|
|
193
220
|
/** 创建一条弧线。
|
|
194
221
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
222
|
+
* - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
|
|
223
|
+
* - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
|
|
197
224
|
*
|
|
198
225
|
* 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
|
|
199
226
|
*
|
|
@@ -443,6 +470,56 @@ declare module '../../index' {
|
|
|
443
470
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html
|
|
444
471
|
*/
|
|
445
472
|
closePath(): void
|
|
473
|
+
/** 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
474
|
+
* @supported weapp
|
|
475
|
+
* @example
|
|
476
|
+
* ```tsx
|
|
477
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
478
|
+
* // Create circular gradient
|
|
479
|
+
* const grd = ctx.createCircularGradient(75, 50, 50)
|
|
480
|
+
* grd.addColorStop(0, 'red')
|
|
481
|
+
* grd.addColorStop(1, 'white')
|
|
482
|
+
* // Fill with gradient
|
|
483
|
+
* ctx.setFillStyle(grd)
|
|
484
|
+
* ctx.fillRect(10, 10, 150, 80)
|
|
485
|
+
* ctx.draw()
|
|
486
|
+
* ```
|
|
487
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html
|
|
488
|
+
*/
|
|
489
|
+
createCircularGradient(
|
|
490
|
+
/** 圆心的 x 坐标 */
|
|
491
|
+
x: number,
|
|
492
|
+
/** 圆心的 y 坐标 */
|
|
493
|
+
y: number,
|
|
494
|
+
/** 圆的半径 */
|
|
495
|
+
r: number,
|
|
496
|
+
): CanvasGradient
|
|
497
|
+
/** 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
498
|
+
* @supported weapp
|
|
499
|
+
* @example
|
|
500
|
+
* ```tsx
|
|
501
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
502
|
+
* // Create linear gradient
|
|
503
|
+
* const grd = ctx.createLinearGradient(0, 0, 200, 0)
|
|
504
|
+
* grd.addColorStop(0, 'red')
|
|
505
|
+
* grd.addColorStop(1, 'white')
|
|
506
|
+
* // Fill with gradient
|
|
507
|
+
* ctx.setFillStyle(grd)
|
|
508
|
+
* ctx.fillRect(10, 10, 150, 80)
|
|
509
|
+
* ctx.draw()
|
|
510
|
+
* ```
|
|
511
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html
|
|
512
|
+
*/
|
|
513
|
+
createLinearGradient(
|
|
514
|
+
/** 起点的 x 坐标 */
|
|
515
|
+
x0: number,
|
|
516
|
+
/** 起点的 y 坐标 */
|
|
517
|
+
y0: number,
|
|
518
|
+
/** 终点的 x 坐标 */
|
|
519
|
+
x1: number,
|
|
520
|
+
/** 终点的 y 坐标 */
|
|
521
|
+
y1: number,
|
|
522
|
+
): CanvasGradient
|
|
446
523
|
/** 对指定的图像创建模式的方法,可在指定的方向上重复元图像
|
|
447
524
|
* @supported weapp
|
|
448
525
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html
|
|
@@ -451,7 +528,7 @@ declare module '../../index' {
|
|
|
451
528
|
/** 重复的图像源,仅支持包内路径和临时路径 */
|
|
452
529
|
image: string,
|
|
453
530
|
/** 如何重复图像 */
|
|
454
|
-
repetition: keyof CanvasContext.
|
|
531
|
+
repetition: keyof CanvasContext.Repetition,
|
|
455
532
|
): void
|
|
456
533
|
/** 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
|
|
457
534
|
* @supported weapp
|
|
@@ -622,7 +699,7 @@ declare module '../../index' {
|
|
|
622
699
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html
|
|
623
700
|
*/
|
|
624
701
|
fill(): void
|
|
625
|
-
/** 填充一个矩形。用 [`setFillStyle`](
|
|
702
|
+
/** 填充一个矩形。用 [`setFillStyle`](/docs/apis/canvas/CanvasContext#setfillstyle) 设置矩形的填充色,如果没设置默认是黑色。
|
|
626
703
|
* @supported weapp
|
|
627
704
|
* @example
|
|
628
705
|
* ```tsx
|
|
@@ -684,6 +761,14 @@ declare module '../../index' {
|
|
|
684
761
|
/** 目标位置的 y 坐标 */
|
|
685
762
|
y: number,
|
|
686
763
|
): void
|
|
764
|
+
/** 测量文本尺寸信息。目前仅返回文本宽度。同步接口。
|
|
765
|
+
* @supported weapp
|
|
766
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html
|
|
767
|
+
*/
|
|
768
|
+
measureText(
|
|
769
|
+
/** 要测量的文本 */
|
|
770
|
+
text: string,
|
|
771
|
+
): TextMetrics
|
|
687
772
|
/** 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
|
|
688
773
|
* @supported weapp
|
|
689
774
|
* @example
|
|
@@ -757,7 +842,7 @@ declare module '../../index' {
|
|
|
757
842
|
/** 结束点的 y 坐标 */
|
|
758
843
|
y: number,
|
|
759
844
|
): void
|
|
760
|
-
/** 创建一个矩形路径。需要用 [`fill`](
|
|
845
|
+
/** 创建一个矩形路径。需要用 [`fill`](/docs/apis/canvas/CanvasContext#fill) 或者 [`stroke`](/docs/apis/canvas/CanvasContext#stroke) 方法将矩形真正的画到 `canvas` 中
|
|
761
846
|
* @supported weapp
|
|
762
847
|
* @example
|
|
763
848
|
* ```tsx
|
|
@@ -779,7 +864,7 @@ declare module '../../index' {
|
|
|
779
864
|
/** 矩形路径的高度 */
|
|
780
865
|
height: number,
|
|
781
866
|
): void
|
|
782
|
-
/**
|
|
867
|
+
/** 恢复之前保存的绘图上下文
|
|
783
868
|
* @supported weapp
|
|
784
869
|
* @example
|
|
785
870
|
* ```tsx
|
|
@@ -940,7 +1025,7 @@ declare module '../../index' {
|
|
|
940
1025
|
*/
|
|
941
1026
|
setLineCap(
|
|
942
1027
|
/** 线条的结束端点样式 */
|
|
943
|
-
lineCap: keyof CanvasContext.
|
|
1028
|
+
lineCap: keyof CanvasContext.LineCap,
|
|
944
1029
|
): void
|
|
945
1030
|
/** 设置虚线样式。
|
|
946
1031
|
* @supported weapp
|
|
@@ -999,7 +1084,7 @@ declare module '../../index' {
|
|
|
999
1084
|
*/
|
|
1000
1085
|
setLineJoin(
|
|
1001
1086
|
/** 线条的结束交点样式 */
|
|
1002
|
-
lineJoin: keyof CanvasContext.
|
|
1087
|
+
lineJoin: keyof CanvasContext.LineJoin,
|
|
1003
1088
|
): void
|
|
1004
1089
|
/** 设置线条的宽度
|
|
1005
1090
|
* @supported weapp
|
|
@@ -1033,7 +1118,7 @@ declare module '../../index' {
|
|
|
1033
1118
|
/** 线条的宽度,单位px */
|
|
1034
1119
|
lineWidth: number,
|
|
1035
1120
|
): void
|
|
1036
|
-
/** 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](
|
|
1121
|
+
/** 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](/docs/apis/canvas/CanvasContext#setlinejoin) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
|
|
1037
1122
|
* @supported weapp
|
|
1038
1123
|
* @example
|
|
1039
1124
|
* ```tsx
|
|
@@ -1137,7 +1222,7 @@ declare module '../../index' {
|
|
|
1137
1222
|
*/
|
|
1138
1223
|
setTextAlign(
|
|
1139
1224
|
/** 文字的对齐方式 */
|
|
1140
|
-
align: keyof CanvasContext.
|
|
1225
|
+
align: keyof CanvasContext.Align,
|
|
1141
1226
|
): void
|
|
1142
1227
|
/** 设置文字的竖直对齐
|
|
1143
1228
|
* @supported weapp
|
|
@@ -1163,7 +1248,7 @@ declare module '../../index' {
|
|
|
1163
1248
|
*/
|
|
1164
1249
|
setTextBaseline(
|
|
1165
1250
|
/** 文字的竖直对齐方式 */
|
|
1166
|
-
textBaseline: keyof CanvasContext.
|
|
1251
|
+
textBaseline: keyof CanvasContext.TextBaseline,
|
|
1167
1252
|
): void
|
|
1168
1253
|
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1169
1254
|
* @supported weapp
|
|
@@ -1218,7 +1303,7 @@ declare module '../../index' {
|
|
|
1218
1303
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html
|
|
1219
1304
|
*/
|
|
1220
1305
|
stroke(): void
|
|
1221
|
-
/** 画一个矩形(非填充)。 用 [`setStrokeStyle`](
|
|
1306
|
+
/** 画一个矩形(非填充)。 用 [`setStrokeStyle`](/docs/apis/canvas/CanvasContext#setstrokestyle) 设置矩形线条的颜色,如果没设置默认是黑色。
|
|
1222
1307
|
* @supported weapp
|
|
1223
1308
|
* @example
|
|
1224
1309
|
* ```tsx
|
|
@@ -1291,100 +1376,10 @@ declare module '../../index' {
|
|
|
1291
1376
|
/** 竖直坐标平移量 */
|
|
1292
1377
|
y: number,
|
|
1293
1378
|
): void
|
|
1294
|
-
/** 测量文本尺寸信息。目前仅返回文本宽度。同步接口。
|
|
1295
|
-
* @supported weapp
|
|
1296
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html
|
|
1297
|
-
*/
|
|
1298
|
-
measureText(
|
|
1299
|
-
/** 要测量的文本 */
|
|
1300
|
-
text: string,
|
|
1301
|
-
): TextMetrics
|
|
1302
|
-
/** 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
|
|
1303
|
-
* @supported weapp
|
|
1304
|
-
* @example
|
|
1305
|
-
* ```tsx
|
|
1306
|
-
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1307
|
-
* // Create circular gradient
|
|
1308
|
-
* const grd = ctx.createCircularGradient(75, 50, 50)
|
|
1309
|
-
* grd.addColorStop(0, 'red')
|
|
1310
|
-
* grd.addColorStop(1, 'white')
|
|
1311
|
-
* // Fill with gradient
|
|
1312
|
-
* ctx.setFillStyle(grd)
|
|
1313
|
-
* ctx.fillRect(10, 10, 150, 80)
|
|
1314
|
-
* ctx.draw()
|
|
1315
|
-
* ```
|
|
1316
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html
|
|
1317
|
-
*/
|
|
1318
|
-
createCircularGradient(
|
|
1319
|
-
/** 圆心的 x 坐标 */
|
|
1320
|
-
x: number,
|
|
1321
|
-
/** 圆心的 y 坐标 */
|
|
1322
|
-
y: number,
|
|
1323
|
-
/** 圆的半径 */
|
|
1324
|
-
r: number,
|
|
1325
|
-
): CanvasGradient
|
|
1326
|
-
/** 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
|
|
1327
|
-
* @supported weapp
|
|
1328
|
-
* @example
|
|
1329
|
-
* ```tsx
|
|
1330
|
-
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1331
|
-
* // Create linear gradient
|
|
1332
|
-
* const grd = ctx.createLinearGradient(0, 0, 200, 0)
|
|
1333
|
-
* grd.addColorStop(0, 'red')
|
|
1334
|
-
* grd.addColorStop(1, 'white')
|
|
1335
|
-
* // Fill with gradient
|
|
1336
|
-
* ctx.setFillStyle(grd)
|
|
1337
|
-
* ctx.fillRect(10, 10, 150, 80)
|
|
1338
|
-
* ctx.draw()
|
|
1339
|
-
* ```
|
|
1340
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html
|
|
1341
|
-
*/
|
|
1342
|
-
createLinearGradient(
|
|
1343
|
-
/** 起点的 x 坐标 */
|
|
1344
|
-
x0: number,
|
|
1345
|
-
/** 起点的 y 坐标 */
|
|
1346
|
-
y0: number,
|
|
1347
|
-
/** 终点的 x 坐标 */
|
|
1348
|
-
x1: number,
|
|
1349
|
-
/** 终点的 y 坐标 */
|
|
1350
|
-
y1: number,
|
|
1351
|
-
): CanvasGradient
|
|
1352
|
-
/** 填充颜色。用法同 [CanvasContext.setFillStyle()]。 */
|
|
1353
|
-
fillStyle: string
|
|
1354
|
-
/** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 */
|
|
1355
|
-
font: string
|
|
1356
|
-
/** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
|
|
1357
|
-
globalAlpha: number
|
|
1358
|
-
/** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
|
|
1359
|
-
*
|
|
1360
|
-
* 目前支持的操作有
|
|
1361
|
-
* - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
|
|
1362
|
-
* - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity */
|
|
1363
|
-
globalCompositeOperation: string
|
|
1364
|
-
/** 线条的端点样式。用法同 [CanvasContext.setLineCap()]。 */
|
|
1365
|
-
lineCap: keyof CanvasContext.lineCap
|
|
1366
|
-
/** 虚线偏移量,初始值为0 */
|
|
1367
|
-
lineDashOffset: number
|
|
1368
|
-
/** 线条的交点样式。用法同 [CanvasContext.setLineJoin()]。 */
|
|
1369
|
-
lineJoin: keyof CanvasContext.lineJoin
|
|
1370
|
-
/** 线条的宽度。用法同 [CanvasContext.setLineWidth()]。 */
|
|
1371
|
-
lineWidth: number
|
|
1372
|
-
/** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()]。 */
|
|
1373
|
-
miterLimit: number
|
|
1374
|
-
/** 阴影的模糊级别 */
|
|
1375
|
-
shadowBlur: number
|
|
1376
|
-
/** 阴影的颜色 */
|
|
1377
|
-
shadowColor: string
|
|
1378
|
-
/** 阴影相对于形状在水平方向的偏移 */
|
|
1379
|
-
shadowOffsetX: number
|
|
1380
|
-
/** 阴影相对于形状在竖直方向的偏移 */
|
|
1381
|
-
shadowOffsetY: number
|
|
1382
|
-
/** 边框颜色。用法同 [CanvasContext.setFillStyle()]。 */
|
|
1383
|
-
strokeStyle: string
|
|
1384
1379
|
}
|
|
1385
1380
|
namespace CanvasContext {
|
|
1386
1381
|
/** 参数 repetition 可选值 */
|
|
1387
|
-
interface
|
|
1382
|
+
interface Repetition {
|
|
1388
1383
|
/** 水平竖直方向都重复 */
|
|
1389
1384
|
'repeat'
|
|
1390
1385
|
/** 水平方向重复 */
|
|
@@ -1396,7 +1391,7 @@ declare module '../../index' {
|
|
|
1396
1391
|
}
|
|
1397
1392
|
|
|
1398
1393
|
/** 参数 lineCap 可选值 */
|
|
1399
|
-
interface
|
|
1394
|
+
interface LineCap {
|
|
1400
1395
|
/** 向线条的每个末端添加平直的边缘。 */
|
|
1401
1396
|
butt
|
|
1402
1397
|
/** 向线条的每个末端添加圆形线帽。 */
|
|
@@ -1405,7 +1400,7 @@ declare module '../../index' {
|
|
|
1405
1400
|
square
|
|
1406
1401
|
}
|
|
1407
1402
|
/** 参数 lineJoin 可选值 */
|
|
1408
|
-
interface
|
|
1403
|
+
interface LineJoin {
|
|
1409
1404
|
/** 斜角 */
|
|
1410
1405
|
bevel
|
|
1411
1406
|
/** 圆角 */
|
|
@@ -1414,7 +1409,7 @@ declare module '../../index' {
|
|
|
1414
1409
|
miter
|
|
1415
1410
|
}
|
|
1416
1411
|
/** 参数 align 可选值 */
|
|
1417
|
-
interface
|
|
1412
|
+
interface Align {
|
|
1418
1413
|
/** 左对齐 */
|
|
1419
1414
|
left
|
|
1420
1415
|
/** 居中对齐 */
|
|
@@ -1423,7 +1418,7 @@ declare module '../../index' {
|
|
|
1423
1418
|
right
|
|
1424
1419
|
}
|
|
1425
1420
|
/** 参数 textBaseline 可选值 */
|
|
1426
|
-
interface
|
|
1421
|
+
interface TextBaseline {
|
|
1427
1422
|
/** 顶部对齐 */
|
|
1428
1423
|
top
|
|
1429
1424
|
/** 底部对齐 */
|
|
@@ -1435,6 +1430,7 @@ declare module '../../index' {
|
|
|
1435
1430
|
}
|
|
1436
1431
|
|
|
1437
1432
|
/** 创建 canvas 的绘图上下文 CanvasContext 对象
|
|
1433
|
+
* @supported weapp
|
|
1438
1434
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html
|
|
1439
1435
|
*/
|
|
1440
1436
|
interface CanvasGradient {
|
|
@@ -1637,16 +1633,21 @@ declare module '../../index' {
|
|
|
1637
1633
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html
|
|
1638
1634
|
*/
|
|
1639
1635
|
interface Image {
|
|
1636
|
+
/** 图片的 URL */
|
|
1637
|
+
src: string
|
|
1640
1638
|
/** 图片的真实高度 */
|
|
1641
1639
|
height: number
|
|
1640
|
+
/** 图片的真实宽度 */
|
|
1641
|
+
width: number
|
|
1642
|
+
/** origin: 发送完整的referrer; no-referrer: 不发送。
|
|
1643
|
+
*
|
|
1644
|
+
* 格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本
|
|
1645
|
+
*/
|
|
1646
|
+
referrerPolicy: string
|
|
1642
1647
|
/** 图片加载发生错误后触发的回调函数 */
|
|
1643
1648
|
onerror: (...args: any[]) => any
|
|
1644
1649
|
/** 图片加载完成后触发的回调函数 */
|
|
1645
1650
|
onload: (...args: any[]) => any
|
|
1646
|
-
/** 图片的 URL */
|
|
1647
|
-
src: string
|
|
1648
|
-
/** 图片的真实宽度 */
|
|
1649
|
-
width: number
|
|
1650
1651
|
}
|
|
1651
1652
|
|
|
1652
1653
|
/** ImageData 对象
|
|
@@ -1654,28 +1655,41 @@ declare module '../../index' {
|
|
|
1654
1655
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html
|
|
1655
1656
|
*/
|
|
1656
1657
|
interface ImageData {
|
|
1657
|
-
/** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
|
|
1658
|
-
data: Uint8ClampedArray
|
|
1659
|
-
/** 使用像素描述 ImageData 的实际高度 */
|
|
1660
|
-
height: number
|
|
1661
1658
|
/** 使用像素描述 ImageData 的实际宽度 */
|
|
1662
1659
|
width: number
|
|
1660
|
+
/** 使用像素描述 ImageData 的实际高度 */
|
|
1661
|
+
height: number
|
|
1662
|
+
/** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
|
|
1663
|
+
data: Uint8ClampedArray
|
|
1663
1664
|
}
|
|
1664
1665
|
|
|
1665
1666
|
/** 离屏 canvas 实例,可通过 Taro.createOffscreenCanvas 创建。
|
|
1667
|
+
* @supported weapp
|
|
1666
1668
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html
|
|
1667
1669
|
*/
|
|
1668
1670
|
interface OffscreenCanvas {
|
|
1669
|
-
/**
|
|
1671
|
+
/** 创建一个图片对象。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法
|
|
1670
1672
|
*
|
|
1671
|
-
*
|
|
1673
|
+
* > 注意不允许混用 webgl 和 2d 画布创建的图片对象,使用时请注意尽量使用 canvas 自身的 createImage 创建图片对象。
|
|
1674
|
+
* @supported weapp
|
|
1675
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.createImage.html
|
|
1676
|
+
*/
|
|
1677
|
+
createImage(): Image
|
|
1678
|
+
/** 该方法返回 OffscreenCanvas 的绘图上下文
|
|
1672
1679
|
*
|
|
1673
|
-
* 当前仅支持获取 WebGL 绘图上下文
|
|
1680
|
+
* > 当前仅支持获取 WebGL 绘图上下文
|
|
1674
1681
|
* @supported weapp
|
|
1682
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html
|
|
1675
1683
|
*/
|
|
1676
1684
|
getContext(contextType: string): RenderingContext
|
|
1677
1685
|
}
|
|
1678
1686
|
|
|
1687
|
+
/** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。
|
|
1688
|
+
* @supported weapp
|
|
1689
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html
|
|
1690
|
+
*/
|
|
1691
|
+
interface Path2D {}
|
|
1692
|
+
|
|
1679
1693
|
/** Canvas 绘图上下文。
|
|
1680
1694
|
*
|
|
1681
1695
|
* ****
|
|
@@ -1694,7 +1708,7 @@ declare module '../../index' {
|
|
|
1694
1708
|
*/
|
|
1695
1709
|
createOffscreenCanvas(): OffscreenCanvas
|
|
1696
1710
|
|
|
1697
|
-
/** 创建 canvas 的绘图上下文 [CanvasContext](
|
|
1711
|
+
/** 创建 canvas 的绘图上下文 [CanvasContext](/docs/apis/canvas/CanvasContext) 对象
|
|
1698
1712
|
*
|
|
1699
1713
|
* **Tip**: 需要指定 canvasId,该绘图上下文只作用于对应的 `<canvas/>`
|
|
1700
1714
|
* @supported weapp, h5
|
|
@@ -1722,9 +1736,9 @@ declare module '../../index' {
|
|
|
1722
1736
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html
|
|
1723
1737
|
*/
|
|
1724
1738
|
createCanvasContext(
|
|
1725
|
-
/** 要获取上下文的 [canvas](
|
|
1739
|
+
/** 要获取上下文的 [canvas](/docs/components/canvas) 组件 canvas-id 属性 */
|
|
1726
1740
|
canvasId: string,
|
|
1727
|
-
/** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](
|
|
1741
|
+
/** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](/docs/components/canvas) ,如果省略则不在任何自定义组件内查找 */
|
|
1728
1742
|
component?: TaroGeneral.IAnyObject,
|
|
1729
1743
|
): CanvasContext
|
|
1730
1744
|
|
|
@@ -1753,11 +1767,11 @@ declare module '../../index' {
|
|
|
1753
1767
|
*/
|
|
1754
1768
|
canvasToTempFilePath(
|
|
1755
1769
|
option: canvasToTempFilePath.Option,
|
|
1756
|
-
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](
|
|
1770
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
1757
1771
|
component?: TaroGeneral.IAnyObject,
|
|
1758
1772
|
): Promise<canvasToTempFilePath.SuccessCallbackResult>
|
|
1759
1773
|
|
|
1760
|
-
/** 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内
|
|
1774
|
+
/** 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 `<canvas>` 组件
|
|
1761
1775
|
* @supported weapp, h5
|
|
1762
1776
|
* @example
|
|
1763
1777
|
* ```tsx
|
|
@@ -1775,7 +1789,7 @@ declare module '../../index' {
|
|
|
1775
1789
|
*/
|
|
1776
1790
|
canvasPutImageData(
|
|
1777
1791
|
option: canvasPutImageData.Option,
|
|
1778
|
-
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](
|
|
1792
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
1779
1793
|
component?: TaroGeneral.IAnyObject,
|
|
1780
1794
|
): Promise<TaroGeneral.CallbackResult>
|
|
1781
1795
|
|
|
@@ -1801,7 +1815,7 @@ declare module '../../index' {
|
|
|
1801
1815
|
*/
|
|
1802
1816
|
canvasGetImageData(
|
|
1803
1817
|
option: canvasGetImageData.Option,
|
|
1804
|
-
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](
|
|
1818
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
1805
1819
|
component?: TaroGeneral.IAnyObject,
|
|
1806
1820
|
): Promise<canvasGetImageData.SuccessCallbackResult>
|
|
1807
1821
|
}
|
|
@@ -215,7 +215,7 @@ declare module '../../index' {
|
|
|
215
215
|
/** 服务路径 */
|
|
216
216
|
path: string
|
|
217
217
|
/** HTTP请求方法,默认 GET */
|
|
218
|
-
method?: keyof request.
|
|
218
|
+
method?: keyof request.Method
|
|
219
219
|
/** 请求数据 */
|
|
220
220
|
data?: P
|
|
221
221
|
/** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
|
|
@@ -223,7 +223,7 @@ declare module '../../index' {
|
|
|
223
223
|
/** 超时时间,单位为毫秒 */
|
|
224
224
|
timeout?: number
|
|
225
225
|
/** 返回的数据格式 */
|
|
226
|
-
dataType?: request.
|
|
226
|
+
dataType?: request.DataType
|
|
227
227
|
/** 响应的数据类型 */
|
|
228
228
|
responseType?: keyof {
|
|
229
229
|
text
|
|
@@ -690,6 +690,21 @@ declare module '../../index' {
|
|
|
690
690
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/Cloud.database.html
|
|
691
691
|
*/
|
|
692
692
|
database(config?: cloud.IConfig): DB.Database
|
|
693
|
+
|
|
694
|
+
/** 调用云托管服务
|
|
695
|
+
* @supported weapp
|
|
696
|
+
* @example
|
|
697
|
+
* 假设已经初始化了一个叫c1的云开发实例,并发起云托管调用
|
|
698
|
+
*
|
|
699
|
+
* ``` tsx
|
|
700
|
+
* const r = await c1.callContainer({
|
|
701
|
+
* path: '/path/to/container', // 填入容器的访问路径
|
|
702
|
+
* method: 'POST',
|
|
703
|
+
* })
|
|
704
|
+
* ```
|
|
705
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/container/Cloud.callContainer.html
|
|
706
|
+
*/
|
|
707
|
+
callContainer < R = any, P = any >(params: cloud.CallContainerParam<P>): Promise<cloud.CallContainerResult<R>>
|
|
693
708
|
}
|
|
694
709
|
|
|
695
710
|
namespace DB {
|
|
@@ -7,7 +7,7 @@ declare module '../../index' {
|
|
|
7
7
|
* 监听加速度数据回调函数的执行频率
|
|
8
8
|
* @default "normal"
|
|
9
9
|
*/
|
|
10
|
-
interval?: keyof
|
|
10
|
+
interval?: keyof Interval
|
|
11
11
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
12
12
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
13
13
|
/** 接口调用失败的回调函数 */
|
|
@@ -16,7 +16,7 @@ declare module '../../index' {
|
|
|
16
16
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
type
|
|
19
|
+
type Interval = {
|
|
20
20
|
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
|
21
21
|
game: 'game',
|
|
22
22
|
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
|
@@ -56,7 +56,7 @@ declare module '../../index' {
|
|
|
56
56
|
* ```tsx
|
|
57
57
|
* Taro.startAccelerometer({ interval: 'game' })
|
|
58
58
|
* ```
|
|
59
|
-
* @supported weapp, h5, rn
|
|
59
|
+
* @supported weapp, h5, rn, tt
|
|
60
60
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html
|
|
61
61
|
*/
|
|
62
62
|
startAccelerometer (res?: startAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -67,14 +67,14 @@ declare module '../../index' {
|
|
|
67
67
|
* ```tsx
|
|
68
68
|
* Taro.stopAccelerometer()
|
|
69
69
|
* ```
|
|
70
|
-
* @supported weapp, h5, rn
|
|
70
|
+
* @supported weapp, h5, rn, tt
|
|
71
71
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html
|
|
72
72
|
*/
|
|
73
73
|
stopAccelerometer (res?: stopAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 `Taro.stopAccelerometer` 停止监听。
|
|
77
|
-
* @supported weapp, h5, rn
|
|
77
|
+
* @supported weapp, h5, rn, tt
|
|
78
78
|
* @example
|
|
79
79
|
* ```tsx
|
|
80
80
|
* Taro.onAccelerometerChange(res => {
|
|
@@ -89,7 +89,7 @@ declare module '../../index' {
|
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
|
|
92
|
-
* @supported weapp, rn
|
|
92
|
+
* @supported weapp, h5, rn
|
|
93
93
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html
|
|
94
94
|
*/
|
|
95
95
|
offAccelerometerChange(
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace checkIsOpenAccessibility {
|
|
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
|
+
/** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */
|
|
15
|
+
open: boolean
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface TaroStatic {
|
|
20
|
+
/** 检测是否开启视觉无障碍功能。
|
|
21
|
+
* @supported weapp
|
|
22
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html
|
|
23
|
+
*/
|
|
24
|
+
checkIsOpenAccessibility(option: checkIsOpenAccessibility.Option): Promise<TaroGeneral.CallbackResult>
|
|
25
|
+
}
|
|
26
|
+
}
|