@tarojs/taro 3.7.0-alpha.8 → 3.7.0-beta.3
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/package.json +11 -4
- package/types/api/ad/index.d.ts +6 -18
- package/types/api/ai/inference.d.ts +4 -8
- package/types/api/ai/visionkit.d.ts +625 -54
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/canvas/index.d.ts +67 -54
- package/types/api/device/accelerometer.d.ts +8 -6
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/bluetooth-ble.d.ts +40 -17
- package/types/api/device/bluetooth-peripheral.d.ts +26 -26
- package/types/api/device/bluetooth.d.ts +37 -13
- package/types/api/device/calendar.d.ts +11 -1
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/compass.d.ts +5 -5
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +10 -8
- package/types/api/device/keyboard.d.ts +7 -5
- package/types/api/device/memory.d.ts +3 -4
- package/types/api/device/motion.d.ts +8 -6
- package/types/api/device/network.d.ts +12 -6
- package/types/api/device/nfc.d.ts +13 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +5 -3
- package/types/api/device/screen.d.ts +27 -11
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +5 -5
- package/types/api/device/wifi.d.ts +25 -13
- package/types/api/media/audio.d.ts +50 -30
- package/types/api/media/camera.d.ts +9 -3
- package/types/api/network/download.d.ts +2 -10
- package/types/api/network/upload.d.ts +2 -10
- package/types/api/open-api/device-voip.d.ts +2 -2
- package/types/api/open-api/login.d.ts +1 -1
- package/types/api/open-api/my-miniprogram.d.ts +2 -2
- package/types/api/open-api/privacy.d.ts +99 -0
- package/types/api/route/index.d.ts +3 -0
- package/types/api/skyline/index.d.ts +59 -0
- package/types/api/storage/cache-manager.d.ts +10 -10
- package/types/api/taro.extend.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +4 -3
- package/types/compile/compiler.d.ts +7 -5
- package/types/compile/config/h5.d.ts +20 -10
- package/types/compile/config/index.d.ts +0 -1
- package/types/compile/config/mini.d.ts +36 -24
- package/types/compile/config/project.d.ts +8 -8
- package/types/compile/config/util.d.ts +18 -8
- package/types/compile/viteCompilerContext.d.ts +130 -0
- package/types/global.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/taro.api.d.ts +3 -0
- package/types/taro.component.d.ts +1 -1
- package/types/taro.config.d.ts +35 -4
- package/types/compile/config/harmony.d.ts +0 -23
|
@@ -32,7 +32,7 @@ declare module '../../index' {
|
|
|
32
32
|
* @supported weapp
|
|
33
33
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html
|
|
34
34
|
*/
|
|
35
|
-
createObserver(callback:
|
|
35
|
+
createObserver(callback: TaroGeneral.TFunc): PerformanceObserver
|
|
36
36
|
/** 该方法返回当前缓冲区中的所有性能数据
|
|
37
37
|
* @supported weapp, tt
|
|
38
38
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html
|
|
@@ -222,23 +222,23 @@ declare module '../../index' {
|
|
|
222
222
|
|
|
223
223
|
/** 预加载下个页面的 WebView
|
|
224
224
|
* @supported weapp
|
|
225
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html
|
|
225
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html
|
|
226
226
|
*/
|
|
227
227
|
preloadWebview(option: preloadWebview.Option): Promise<TaroGeneral.CallbackResult>
|
|
228
228
|
|
|
229
229
|
/**预加载下个页面所需要的 Skyline 运行环境
|
|
230
230
|
* @supported weapp
|
|
231
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html
|
|
231
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html
|
|
232
232
|
*/
|
|
233
233
|
preloadSkylineView(option: preloadSkylineView.Option): Promise<TaroGeneral.CallbackResult>
|
|
234
234
|
|
|
235
235
|
/** 为视图层预加载媒体资源文件, 目前支持:font,image
|
|
236
236
|
* @supported weapp
|
|
237
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html
|
|
237
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html
|
|
238
238
|
*/
|
|
239
239
|
preloadAssets(option: preloadAssets.Option): Promise<TaroGeneral.CallbackResult>
|
|
240
240
|
/** 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
|
|
241
|
-
*
|
|
241
|
+
*
|
|
242
242
|
* **注意**
|
|
243
243
|
* - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) `时,evaluateScript` 将仅包含公有部分代码,页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
|
|
244
244
|
* - `firstPaint` 和 `firstContentfulPaint` 指标在开启 `vconsole` 的情况下,由于绘制 `vconsoel` 的面板,会导致数据提前。
|
|
@@ -242,7 +242,7 @@ declare module '../../index' {
|
|
|
242
242
|
* - 绿色: 圆心 (100, 75)
|
|
243
243
|
* - 红色: 起始弧度 (0)
|
|
244
244
|
* - 蓝色: 终止弧度 (1.5 * Math.PI)
|
|
245
|
-
* @supported weapp
|
|
245
|
+
* @supported weapp, h5
|
|
246
246
|
* @example
|
|
247
247
|
* ```tsx
|
|
248
248
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -300,7 +300,7 @@ declare module '../../index' {
|
|
|
300
300
|
counterclockwise?: boolean,
|
|
301
301
|
): void
|
|
302
302
|
/** 根据控制点和半径绘制圆弧路径。
|
|
303
|
-
* @supported weapp
|
|
303
|
+
* @supported weapp, h5
|
|
304
304
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html
|
|
305
305
|
*/
|
|
306
306
|
arcTo(
|
|
@@ -319,7 +319,7 @@ declare module '../../index' {
|
|
|
319
319
|
*
|
|
320
320
|
* - 在最开始的时候相当于调用了一次 `beginPath`。
|
|
321
321
|
* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
|
|
322
|
-
* @supported weapp
|
|
322
|
+
* @supported weapp, h5
|
|
323
323
|
* @example
|
|
324
324
|
* ```tsx
|
|
325
325
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -349,7 +349,7 @@ declare module '../../index' {
|
|
|
349
349
|
* - 红色:起始点(20, 20)
|
|
350
350
|
* - 蓝色:两个控制点(20, 100) (200, 100)
|
|
351
351
|
* - 绿色:终止点(200, 20)
|
|
352
|
-
* @supported weapp
|
|
352
|
+
* @supported weapp, h5
|
|
353
353
|
* @example
|
|
354
354
|
* ```tsx
|
|
355
355
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -404,7 +404,7 @@ declare module '../../index' {
|
|
|
404
404
|
y: number,
|
|
405
405
|
): void
|
|
406
406
|
/** 清除画布上在该矩形区域内的内容
|
|
407
|
-
* @supported weapp
|
|
407
|
+
* @supported weapp, h5
|
|
408
408
|
* @example
|
|
409
409
|
* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
|
|
410
410
|
* ```html
|
|
@@ -432,7 +432,7 @@ declare module '../../index' {
|
|
|
432
432
|
height: number,
|
|
433
433
|
): void
|
|
434
434
|
/** 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
|
|
435
|
-
* @supported weapp
|
|
435
|
+
* @supported weapp, h5
|
|
436
436
|
* @example
|
|
437
437
|
* ```tsx
|
|
438
438
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -453,7 +453,7 @@ declare module '../../index' {
|
|
|
453
453
|
*/
|
|
454
454
|
clip(): void
|
|
455
455
|
/** 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
|
|
456
|
-
* @supported weapp
|
|
456
|
+
* @supported weapp, h5
|
|
457
457
|
* @example
|
|
458
458
|
* ```tsx
|
|
459
459
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -486,7 +486,7 @@ declare module '../../index' {
|
|
|
486
486
|
*/
|
|
487
487
|
closePath(): void
|
|
488
488
|
/** 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
489
|
-
* @supported weapp
|
|
489
|
+
* @supported weapp, h5
|
|
490
490
|
* @example
|
|
491
491
|
* ```tsx
|
|
492
492
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -510,7 +510,7 @@ declare module '../../index' {
|
|
|
510
510
|
r: number,
|
|
511
511
|
): CanvasGradient
|
|
512
512
|
/** 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
513
|
-
* @supported weapp
|
|
513
|
+
* @supported weapp, h5
|
|
514
514
|
* @example
|
|
515
515
|
* ```tsx
|
|
516
516
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -536,7 +536,7 @@ declare module '../../index' {
|
|
|
536
536
|
y1: number,
|
|
537
537
|
): CanvasGradient
|
|
538
538
|
/** 对指定的图像创建模式的方法,可在指定的方向上重复元图像
|
|
539
|
-
* @supported weapp
|
|
539
|
+
* @supported weapp, h5
|
|
540
540
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html
|
|
541
541
|
*/
|
|
542
542
|
createPattern(
|
|
@@ -544,9 +544,10 @@ declare module '../../index' {
|
|
|
544
544
|
image: string,
|
|
545
545
|
/** 如何重复图像 */
|
|
546
546
|
repetition: keyof CanvasContext.Repetition,
|
|
547
|
-
):
|
|
547
|
+
): CanvasPattern | null | Promise<CanvasPattern | null>
|
|
548
548
|
/** 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
|
|
549
|
-
* @supported weapp
|
|
549
|
+
* @supported weapp, h5
|
|
550
|
+
* @h5 第二次调用 draw 前需要等待上一次 draw 调用结束后再调用,否则新的一次 draw 调用栈不会清空而导致结果异常。
|
|
550
551
|
* @example
|
|
551
552
|
* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
|
|
552
553
|
*
|
|
@@ -554,9 +555,10 @@ declare module '../../index' {
|
|
|
554
555
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
555
556
|
* ctx.setFillStyle('red')
|
|
556
557
|
* ctx.fillRect(10, 10, 150, 100)
|
|
557
|
-
* ctx.draw()
|
|
558
|
-
*
|
|
559
|
-
*
|
|
558
|
+
* ctx.draw(false, () => {
|
|
559
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
560
|
+
* ctx.draw(true)
|
|
561
|
+
* })
|
|
560
562
|
* ```
|
|
561
563
|
* @example
|
|
562
564
|
* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
|
|
@@ -565,9 +567,10 @@ declare module '../../index' {
|
|
|
565
567
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
566
568
|
* ctx.setFillStyle('red')
|
|
567
569
|
* ctx.fillRect(10, 10, 150, 100)
|
|
568
|
-
* ctx.draw()
|
|
569
|
-
*
|
|
570
|
-
*
|
|
570
|
+
* ctx.draw(false, () => {
|
|
571
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
572
|
+
* ctx.draw()
|
|
573
|
+
* })
|
|
571
574
|
* ```
|
|
572
575
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html
|
|
573
576
|
*/
|
|
@@ -576,9 +579,9 @@ declare module '../../index' {
|
|
|
576
579
|
reserve?: boolean,
|
|
577
580
|
/** 绘制完成后执行的回调函数 */
|
|
578
581
|
callback?: (...args: any[]) => any,
|
|
579
|
-
): void
|
|
582
|
+
): void | Promise<void>
|
|
580
583
|
/** 绘制图像到画布
|
|
581
|
-
* @supported weapp
|
|
584
|
+
* @supported weapp, h5
|
|
582
585
|
* @example
|
|
583
586
|
* 有三个版本的写法:
|
|
584
587
|
*
|
|
@@ -606,7 +609,7 @@ declare module '../../index' {
|
|
|
606
609
|
dy: number,
|
|
607
610
|
): void
|
|
608
611
|
/** 绘制图像到画布
|
|
609
|
-
* @supported weapp
|
|
612
|
+
* @supported weapp, h5
|
|
610
613
|
* @example
|
|
611
614
|
* 有三个版本的写法:
|
|
612
615
|
*
|
|
@@ -638,7 +641,7 @@ declare module '../../index' {
|
|
|
638
641
|
dHeight: number,
|
|
639
642
|
): void
|
|
640
643
|
/** 绘制图像到画布
|
|
641
|
-
* @supported weapp
|
|
644
|
+
* @supported weapp, h5
|
|
642
645
|
* @example
|
|
643
646
|
* 有三个版本的写法:
|
|
644
647
|
*
|
|
@@ -678,7 +681,7 @@ declare module '../../index' {
|
|
|
678
681
|
dHeight: number,
|
|
679
682
|
): void
|
|
680
683
|
/** 对当前路径中的内容进行填充。默认的填充色为黑色。
|
|
681
|
-
* @supported weapp
|
|
684
|
+
* @supported weapp, h5
|
|
682
685
|
* @example
|
|
683
686
|
* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
|
|
684
687
|
*
|
|
@@ -715,7 +718,7 @@ declare module '../../index' {
|
|
|
715
718
|
*/
|
|
716
719
|
fill(): void
|
|
717
720
|
/** 填充一个矩形。用 [`setFillStyle`](/docs/apis/canvas/CanvasContext#setfillstyle) 设置矩形的填充色,如果没设置默认是黑色。
|
|
718
|
-
* @supported weapp
|
|
721
|
+
* @supported weapp, h5
|
|
719
722
|
* @example
|
|
720
723
|
* ```tsx
|
|
721
724
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -736,7 +739,7 @@ declare module '../../index' {
|
|
|
736
739
|
height: number,
|
|
737
740
|
): void
|
|
738
741
|
/** 在画布上绘制被填充的文本
|
|
739
|
-
* @supported weapp
|
|
742
|
+
* @supported weapp, h5
|
|
740
743
|
* @example
|
|
741
744
|
* ```tsx
|
|
742
745
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -758,7 +761,7 @@ declare module '../../index' {
|
|
|
758
761
|
maxWidth?: number,
|
|
759
762
|
): void
|
|
760
763
|
/** 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
|
|
761
|
-
* @supported weapp
|
|
764
|
+
* @supported weapp, h5
|
|
762
765
|
* @example
|
|
763
766
|
* ```tsx
|
|
764
767
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -777,7 +780,7 @@ declare module '../../index' {
|
|
|
777
780
|
y: number,
|
|
778
781
|
): void
|
|
779
782
|
/** 测量文本尺寸信息。目前仅返回文本宽度。同步接口。
|
|
780
|
-
* @supported weapp
|
|
783
|
+
* @supported weapp, h5
|
|
781
784
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html
|
|
782
785
|
*/
|
|
783
786
|
measureText(
|
|
@@ -785,7 +788,7 @@ declare module '../../index' {
|
|
|
785
788
|
text: string,
|
|
786
789
|
): TextMetrics
|
|
787
790
|
/** 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
|
|
788
|
-
* @supported weapp
|
|
791
|
+
* @supported weapp, h5
|
|
789
792
|
* @example
|
|
790
793
|
* ```tsx
|
|
791
794
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -811,7 +814,7 @@ declare module '../../index' {
|
|
|
811
814
|
* - 红色:起始点(20, 20)
|
|
812
815
|
* - 蓝色:控制点(20, 100)
|
|
813
816
|
* - 绿色:终止点(200, 20)
|
|
814
|
-
* @supported weapp
|
|
817
|
+
* @supported weapp, h5
|
|
815
818
|
* @example
|
|
816
819
|
* ```tsx
|
|
817
820
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -858,7 +861,7 @@ declare module '../../index' {
|
|
|
858
861
|
y: number,
|
|
859
862
|
): void
|
|
860
863
|
/** 创建一个矩形路径。需要用 [`fill`](/docs/apis/canvas/CanvasContext#fill) 或者 [`stroke`](/docs/apis/canvas/CanvasContext#stroke) 方法将矩形真正的画到 `canvas` 中
|
|
861
|
-
* @supported weapp
|
|
864
|
+
* @supported weapp, h5
|
|
862
865
|
* @example
|
|
863
866
|
* ```tsx
|
|
864
867
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -879,8 +882,13 @@ declare module '../../index' {
|
|
|
879
882
|
/** 矩形路径的高度 */
|
|
880
883
|
height: number,
|
|
881
884
|
): void
|
|
885
|
+
/** 重置绘图上下文状态
|
|
886
|
+
* @supported h5
|
|
887
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset
|
|
888
|
+
*/
|
|
889
|
+
reset(): void
|
|
882
890
|
/** 恢复之前保存的绘图上下文
|
|
883
|
-
* @supported weapp
|
|
891
|
+
* @supported weapp, h5
|
|
884
892
|
* @example
|
|
885
893
|
* ```tsx
|
|
886
894
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -897,7 +905,7 @@ declare module '../../index' {
|
|
|
897
905
|
*/
|
|
898
906
|
restore(): void
|
|
899
907
|
/** 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
|
|
900
|
-
* @supported weapp
|
|
908
|
+
* @supported weapp, h5
|
|
901
909
|
* @example
|
|
902
910
|
* ```tsx
|
|
903
911
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -915,7 +923,7 @@ declare module '../../index' {
|
|
|
915
923
|
rotate: number,
|
|
916
924
|
): void
|
|
917
925
|
/** 保存绘图上下文。
|
|
918
|
-
* @supported weapp
|
|
926
|
+
* @supported weapp, h5
|
|
919
927
|
* @example
|
|
920
928
|
* ```tsx
|
|
921
929
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -932,7 +940,7 @@ declare module '../../index' {
|
|
|
932
940
|
*/
|
|
933
941
|
save(): void
|
|
934
942
|
/** 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
|
|
935
|
-
* @supported weapp
|
|
943
|
+
* @supported weapp, h5
|
|
936
944
|
* @example
|
|
937
945
|
* ```tsx
|
|
938
946
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -952,7 +960,7 @@ declare module '../../index' {
|
|
|
952
960
|
scaleHeight: number,
|
|
953
961
|
): void
|
|
954
962
|
/** 设置填充色。
|
|
955
|
-
* @supported weapp
|
|
963
|
+
* @supported weapp, h5
|
|
956
964
|
* @example
|
|
957
965
|
* ```tsx
|
|
958
966
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -967,7 +975,7 @@ declare module '../../index' {
|
|
|
967
975
|
color: string | CanvasGradient,
|
|
968
976
|
): void
|
|
969
977
|
/** 设置字体的字号
|
|
970
|
-
* @supported weapp
|
|
978
|
+
* @supported weapp, h5
|
|
971
979
|
* @example
|
|
972
980
|
* ```tsx
|
|
973
981
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -988,7 +996,7 @@ declare module '../../index' {
|
|
|
988
996
|
fontSize: number,
|
|
989
997
|
): void
|
|
990
998
|
/** 设置全局画笔透明度。
|
|
991
|
-
* @supported weapp
|
|
999
|
+
* @supported weapp, h5
|
|
992
1000
|
* @example
|
|
993
1001
|
* ```tsx
|
|
994
1002
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1008,7 +1016,7 @@ declare module '../../index' {
|
|
|
1008
1016
|
alpha: number,
|
|
1009
1017
|
): void
|
|
1010
1018
|
/** 设置线条的端点样式
|
|
1011
|
-
* @supported weapp
|
|
1019
|
+
* @supported weapp, h5
|
|
1012
1020
|
* @example
|
|
1013
1021
|
* ```tsx
|
|
1014
1022
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1043,7 +1051,7 @@ declare module '../../index' {
|
|
|
1043
1051
|
lineCap: keyof CanvasContext.LineCap,
|
|
1044
1052
|
): void
|
|
1045
1053
|
/** 设置虚线样式。
|
|
1046
|
-
* @supported weapp
|
|
1054
|
+
* @supported weapp, h5
|
|
1047
1055
|
* @example
|
|
1048
1056
|
* ```tsx
|
|
1049
1057
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1063,7 +1071,7 @@ declare module '../../index' {
|
|
|
1063
1071
|
offset: number,
|
|
1064
1072
|
): void
|
|
1065
1073
|
/** 设置线条的交点样式
|
|
1066
|
-
* @supported weapp
|
|
1074
|
+
* @supported weapp, h5
|
|
1067
1075
|
* @example
|
|
1068
1076
|
* ```tsx
|
|
1069
1077
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1102,7 +1110,7 @@ declare module '../../index' {
|
|
|
1102
1110
|
lineJoin: keyof CanvasContext.LineJoin,
|
|
1103
1111
|
): void
|
|
1104
1112
|
/** 设置线条的宽度
|
|
1105
|
-
* @supported weapp
|
|
1113
|
+
* @supported weapp, h5
|
|
1106
1114
|
* @example
|
|
1107
1115
|
* ```tsx
|
|
1108
1116
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1134,7 +1142,7 @@ declare module '../../index' {
|
|
|
1134
1142
|
lineWidth: number,
|
|
1135
1143
|
): void
|
|
1136
1144
|
/** 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](/docs/apis/canvas/CanvasContext#setlinejoin) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
|
|
1137
|
-
* @supported weapp
|
|
1145
|
+
* @supported weapp, h5
|
|
1138
1146
|
* @example
|
|
1139
1147
|
* ```tsx
|
|
1140
1148
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1179,7 +1187,7 @@ declare module '../../index' {
|
|
|
1179
1187
|
miterLimit: number,
|
|
1180
1188
|
): void
|
|
1181
1189
|
/** 设定阴影样式。
|
|
1182
|
-
* @supported weapp
|
|
1190
|
+
* @supported weapp, h5
|
|
1183
1191
|
* @example
|
|
1184
1192
|
* ```tsx
|
|
1185
1193
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1201,7 +1209,7 @@ declare module '../../index' {
|
|
|
1201
1209
|
color: string,
|
|
1202
1210
|
): void
|
|
1203
1211
|
/** 设置描边颜色。
|
|
1204
|
-
* @supported weapp
|
|
1212
|
+
* @supported weapp, h5
|
|
1205
1213
|
* @example
|
|
1206
1214
|
* ```tsx
|
|
1207
1215
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1216,7 +1224,7 @@ declare module '../../index' {
|
|
|
1216
1224
|
color: string | CanvasGradient,
|
|
1217
1225
|
): void
|
|
1218
1226
|
/** 设置文字的对齐
|
|
1219
|
-
* @supported weapp
|
|
1227
|
+
* @supported weapp, h5
|
|
1220
1228
|
* @example
|
|
1221
1229
|
* ```tsx
|
|
1222
1230
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1227,11 +1235,13 @@ declare module '../../index' {
|
|
|
1227
1235
|
* ctx.setFontSize(15)
|
|
1228
1236
|
* ctx.setTextAlign('left')
|
|
1229
1237
|
* ctx.fillText('textAlign=left', 150, 60)
|
|
1238
|
+
* await ctx.draw(true)
|
|
1230
1239
|
* ctx.setTextAlign('center')
|
|
1231
1240
|
* ctx.fillText('textAlign=center', 150, 80)
|
|
1241
|
+
* await ctx.draw(true)
|
|
1232
1242
|
* ctx.setTextAlign('right')
|
|
1233
1243
|
* ctx.fillText('textAlign=right', 150, 100)
|
|
1234
|
-
* ctx.draw()
|
|
1244
|
+
* await ctx.draw(true)
|
|
1235
1245
|
* ```
|
|
1236
1246
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html
|
|
1237
1247
|
*/
|
|
@@ -1240,7 +1250,7 @@ declare module '../../index' {
|
|
|
1240
1250
|
align: keyof CanvasContext.Align,
|
|
1241
1251
|
): void
|
|
1242
1252
|
/** 设置文字的竖直对齐
|
|
1243
|
-
* @supported weapp
|
|
1253
|
+
* @supported weapp, h5
|
|
1244
1254
|
* @example
|
|
1245
1255
|
* ```tsx
|
|
1246
1256
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1251,13 +1261,16 @@ declare module '../../index' {
|
|
|
1251
1261
|
* ctx.setFontSize(20)
|
|
1252
1262
|
* ctx.setTextBaseline('top')
|
|
1253
1263
|
* ctx.fillText('top', 5, 75)
|
|
1264
|
+
* await ctx.draw(true)
|
|
1254
1265
|
* ctx.setTextBaseline('middle')
|
|
1255
1266
|
* ctx.fillText('middle', 50, 75)
|
|
1267
|
+
* await ctx.draw(true)
|
|
1256
1268
|
* ctx.setTextBaseline('bottom')
|
|
1257
1269
|
* ctx.fillText('bottom', 120, 75)
|
|
1270
|
+
* await ctx.draw(true)
|
|
1258
1271
|
* ctx.setTextBaseline('normal')
|
|
1259
1272
|
* ctx.fillText('normal', 200, 75)
|
|
1260
|
-
* ctx.draw()
|
|
1273
|
+
* await ctx.draw(true)
|
|
1261
1274
|
* ```
|
|
1262
1275
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html
|
|
1263
1276
|
*/
|
|
@@ -1266,7 +1279,7 @@ declare module '../../index' {
|
|
|
1266
1279
|
textBaseline: keyof CanvasContext.TextBaseline,
|
|
1267
1280
|
): void
|
|
1268
1281
|
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1269
|
-
* @supported weapp
|
|
1282
|
+
* @supported weapp, h5
|
|
1270
1283
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html
|
|
1271
1284
|
*/
|
|
1272
1285
|
setTransform(
|
|
@@ -1284,7 +1297,7 @@ declare module '../../index' {
|
|
|
1284
1297
|
translateY: number,
|
|
1285
1298
|
): void
|
|
1286
1299
|
/** 画出当前路径的边框。默认颜色色为黑色。
|
|
1287
|
-
* @supported weapp
|
|
1300
|
+
* @supported weapp, h5
|
|
1288
1301
|
* @example
|
|
1289
1302
|
* ```tsx
|
|
1290
1303
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1319,7 +1332,7 @@ declare module '../../index' {
|
|
|
1319
1332
|
*/
|
|
1320
1333
|
stroke(): void
|
|
1321
1334
|
/** 画一个矩形(非填充)。 用 [`setStrokeStyle`](/docs/apis/canvas/CanvasContext#setstrokestyle) 设置矩形线条的颜色,如果没设置默认是黑色。
|
|
1322
|
-
* @supported weapp
|
|
1335
|
+
* @supported weapp, h5
|
|
1323
1336
|
* @example
|
|
1324
1337
|
* ```tsx
|
|
1325
1338
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1340,7 +1353,7 @@ declare module '../../index' {
|
|
|
1340
1353
|
height: number,
|
|
1341
1354
|
): void
|
|
1342
1355
|
/** 给定的 (x, y) 位置绘制文本描边的方法
|
|
1343
|
-
* @supported weapp
|
|
1356
|
+
* @supported weapp, h5
|
|
1344
1357
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html
|
|
1345
1358
|
*/
|
|
1346
1359
|
strokeText(
|
|
@@ -1354,7 +1367,7 @@ declare module '../../index' {
|
|
|
1354
1367
|
maxWidth?: number,
|
|
1355
1368
|
): void
|
|
1356
1369
|
/** 使用矩阵多次叠加当前变换的方法
|
|
1357
|
-
* @supported weapp
|
|
1370
|
+
* @supported weapp, h5
|
|
1358
1371
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html
|
|
1359
1372
|
*/
|
|
1360
1373
|
transform(
|
|
@@ -1372,7 +1385,7 @@ declare module '../../index' {
|
|
|
1372
1385
|
translateY: number,
|
|
1373
1386
|
): void
|
|
1374
1387
|
/** 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
|
|
1375
|
-
* @supported weapp
|
|
1388
|
+
* @supported weapp, h5
|
|
1376
1389
|
* @example
|
|
1377
1390
|
* ```tsx
|
|
1378
1391
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -56,7 +56,7 @@ declare module '../../index' {
|
|
|
56
56
|
* ```tsx
|
|
57
57
|
* Taro.startAccelerometer({ interval: 'game' })
|
|
58
58
|
* ```
|
|
59
|
-
* @supported weapp,
|
|
59
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
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,
|
|
70
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
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,
|
|
77
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
78
78
|
* @example
|
|
79
79
|
* ```tsx
|
|
80
80
|
* Taro.onAccelerometerChange(res => {
|
|
@@ -85,16 +85,18 @@ declare module '../../index' {
|
|
|
85
85
|
* ```
|
|
86
86
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html
|
|
87
87
|
*/
|
|
88
|
-
onAccelerometerChange
|
|
88
|
+
onAccelerometerChange(
|
|
89
|
+
callback: onAccelerometerChange.Callback
|
|
90
|
+
): void
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
93
|
* 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
|
|
92
|
-
* @supported weapp, h5, rn
|
|
94
|
+
* @supported weapp, alipay, swan, jd, tt, h5, rn
|
|
93
95
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html
|
|
94
96
|
*/
|
|
95
97
|
offAccelerometerChange(
|
|
96
98
|
/** 加速度数据事件的回调函数 */
|
|
97
|
-
callback?:
|
|
99
|
+
callback?: onAccelerometerChange.Callback
|
|
98
100
|
): void
|
|
99
101
|
}
|
|
100
102
|
}
|
|
@@ -18,7 +18,7 @@ declare module '../../index' {
|
|
|
18
18
|
|
|
19
19
|
interface TaroStatic {
|
|
20
20
|
/** 检测是否开启视觉无障碍功能。
|
|
21
|
-
* @supported weapp
|
|
21
|
+
* @supported weapp, jd
|
|
22
22
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html
|
|
23
23
|
*/
|
|
24
24
|
checkIsOpenAccessibility(option: checkIsOpenAccessibility.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -32,13 +32,13 @@ declare module '../../index' {
|
|
|
32
32
|
|
|
33
33
|
interface TaroStatic {
|
|
34
34
|
/** Taro.getBatteryInfo 的同步版本
|
|
35
|
-
* @supported weapp
|
|
35
|
+
* @supported weapp, alipay, swan, jd, qq
|
|
36
36
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html
|
|
37
37
|
*/
|
|
38
38
|
getBatteryInfoSync(): getBatteryInfoSync.Result
|
|
39
39
|
|
|
40
40
|
/** 获取设备电量。同步 API Taro.getBatteryInfoSync 在 iOS 上不可用。
|
|
41
|
-
* @supported weapp, h5
|
|
41
|
+
* @supported weapp, alipay, swan, jd, qq, h5
|
|
42
42
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html
|
|
43
43
|
*/
|
|
44
44
|
getBatteryInfo(option?: getBatteryInfo.Option): Promise<getBatteryInfo.SuccessCallbackResult>
|