@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,69 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace getOpenUserInfo {
5
+ interface Option {
6
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
+ complete?:(res: TaroGeneral.CallbackResult) => void
8
+ /** 接口调用失败的回调函数 */
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (res: SuccessCallbackResult) => void
12
+ }
13
+ interface SuccessCallbackResult {
14
+ /** 返回一个 Object 类型的对象 res。使用 JSON.parse(res.response).response 解析 */
15
+ response: string
16
+ }
17
+ }
18
+ namespace tradePay {
19
+ interface Option {
20
+ /** 接入小程序支付时传入此参数。此参数为支付宝交易号,注意参数有大小写区分(调用 小程序支付 时必填) */
21
+ tradeNO?: string
22
+ /** 完整的支付参数拼接成的字符串,从服务端获取(调用 支付宝预授权 时必填) */
23
+ orderStr?: string
24
+ /** 接口调用成功的回调函数 */
25
+ success?: (res: SuccessCallbackResult) => void
26
+ /** 接口调用失败的回调函数 */
27
+ fail?: (res: TaroGeneral.CallbackResult) => void
28
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
29
+ complete?:(res: TaroGeneral.CallbackResult) => void
30
+ }
31
+ interface ResultCode {
32
+ /** 无权限调用(N22104) */
33
+ 4
34
+ /** 订单处理成功 */
35
+ 9000
36
+ /** 正在处理中。支付结果未知(有可能已经支付成功) */
37
+ 8000
38
+ /** 订单处理失败 */
39
+ 4000
40
+ /** 用户中途取消 */
41
+ 6001
42
+ /** 网络连接出错 */
43
+ 6002
44
+ /** 处理结果未知(有可能已经成功) */
45
+ 6004
46
+ }
47
+ interface SuccessCallbackResult {
48
+ /** success 回调函数会携带一个 Object 类型的对象,其属性如下: */
49
+ response: {
50
+ resultCode: ResultCode
51
+ }
52
+ }
53
+ }
54
+ interface TaroStatic {
55
+ /**
56
+ * 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。
57
+ * @supported alipay
58
+ * @see https://docs.alipay.com/mini/api/ch8chh
59
+ */
60
+ getOpenUserInfo(Option: getOpenUserInfo.Option): Promise<getOpenUserInfo.SuccessCallbackResult>
61
+
62
+ /**
63
+ * 此接口是用于发起支付的 API,此 API 暂仅支持企业支付宝小程序使用
64
+ * @supported alipay
65
+ * @see https://opendocs.alipay.com/mini/api/openapi-pay
66
+ */
67
+ tradePay(Option: tradePay.Option): Promise<tradePay.SuccessCallbackResult>
68
+ }
69
+ }
@@ -0,0 +1,104 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ /** 用户加密模块
5
+ * @supported weapp
6
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.html
7
+ */
8
+ interface UserCryptoManager {
9
+ /** 获取最新的用户加密密钥
10
+ * @supported weapp
11
+ * @example
12
+ * ```tsx
13
+ * const userCryptoManager = Taro.getUserCryptoManager()
14
+ * userCryptoManager.getLatestUserKey({
15
+ * success: res => {
16
+ * const { encryptKey, iv, version, expireTime } = res
17
+ * console.log(encryptKey, iv, version, expireTime)
18
+ * }
19
+ * })
20
+ * ```
21
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html
22
+ */
23
+ getLatestUserKey(option: UserCryptoManager.getLatestUserKey.Option): Promise<UserCryptoManager.getLatestUserKey.SuccessCallbackResult>
24
+
25
+ /** 获取密码学安全随机数
26
+ * @supported weapp
27
+ * @example
28
+ * ```tsx
29
+ * Taro.getUserCryptoManager().getRandomValues({
30
+ * length: 6 // 生成 6 个字节长度的随机数,
31
+ * success: res => {
32
+ * console.log(Taro.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
33
+ * }
34
+ * })
35
+ * ```
36
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html
37
+ */
38
+ getRandomValues(option: UserCryptoManager.getRandomValues.Option): void
39
+ }
40
+
41
+ namespace UserCryptoManager {
42
+ namespace getLatestUserKey {
43
+ interface Option {
44
+ /** 接口调用成功的回调函数 */
45
+ success?: (res: SuccessCallbackResult) => void
46
+ /** 接口调用失败的回调函数 */
47
+ fail?: (res: TaroGeneral.CallbackResult) => void
48
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
49
+ complete?: (res: SuccessCallbackResult) => void
50
+ }
51
+
52
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
53
+ /** 用户加密密钥 */
54
+ encryptKey: string
55
+ /** 密钥初始向量 */
56
+ iv: string
57
+ /** 密钥版本 */
58
+ version: number
59
+ /** 密钥过期时间 */
60
+ expireTime: number
61
+ }
62
+ }
63
+
64
+ namespace getRandomValues {
65
+ interface Option {
66
+ /** 整数,生成随机数的字节数,最大 1048576 */
67
+ length: number
68
+ /** 接口调用成功的回调函数 */
69
+ success?: (res: SuccessCallbackResult) => void
70
+ /** 接口调用失败的回调函数 */
71
+ fail?: (res: TaroGeneral.CallbackResult) => void
72
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
73
+ complete?: (res: SuccessCallbackResult) => void
74
+ }
75
+
76
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
77
+ /** 随机数内容,长度为传入的字节数 */
78
+ randomValues: ArrayBuffer
79
+ }
80
+ }
81
+ }
82
+
83
+ interface TaroStatic {
84
+ /** 获取用户加密模块
85
+ * @supported weapp
86
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html
87
+ */
88
+ getUserCryptoManager(): UserCryptoManager
89
+
90
+ /** 获取密码学安全随机数
91
+ * @supported weapp
92
+ * @example
93
+ * ```tsx
94
+ * Taro.getRandomValues({
95
+ * length: 6 // 生成 6 个字节长度的随机数
96
+ * }).then(res => {
97
+ * console.log(Taro.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
98
+ * })
99
+ * ```
100
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html
101
+ */
102
+ getRandomValues(option: UserCryptoManager.getRandomValues.Option): Promise<UserCryptoManager.getRandomValues.SuccessCallbackResult>
103
+ }
104
+ }
@@ -0,0 +1,329 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace setEnableDebug {
5
+ type Option = {
6
+ /** 是否打开调试 */
7
+ enableDebug: boolean
8
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用失败的回调函数 */
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用成功的回调函数 */
13
+ success?: (res: TaroGeneral.CallbackResult) => void
14
+ }
15
+ interface Promised extends TaroGeneral.CallbackResult {
16
+ /** 调用结果 */
17
+ errMsg: string
18
+ }
19
+ }
20
+
21
+ namespace getLogManager {
22
+ type Option = {
23
+ /**
24
+ * @default 0
25
+ */
26
+ level?: keyof Level
27
+ }
28
+
29
+ type Level = {
30
+ /** 表示会把 App、Page 的生命周期函数和 wx 命名空间下的函数调用写入日志 */
31
+ 0
32
+ /** 表示不会把 App、Page 的生命周期函数和 wx 命名空间下的函数调用写入日志 */
33
+ 1
34
+ }
35
+ }
36
+
37
+ /** 向调试面板中打印日志。console 是一个全局对象,可以直接访问。在微信客户端中,向 vConsole 中输出日志。
38
+ *
39
+ * **注意**
40
+ * - 由于 vConsole 功能有限,以及不同客户端对 console 方法的支持情况有差异,建议开发者在小程序中只使用本文档中提供的方法。
41
+ * - 部分内容展示的限制请参见调试
42
+ * @supported weapp, harmony_hybrid
43
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.html
44
+ */
45
+ interface console {
46
+ /** 向调试面板中打印 debug 日志
47
+ * @supported weapp, harmony_hybrid
48
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html
49
+ */
50
+ debug(
51
+ /** 日志内容,可以有任意多个。 */
52
+ ...args: any[]
53
+ ): void
54
+ /** 向调试面板中打印 error 日志
55
+ * @supported weapp, harmony_hybrid
56
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html
57
+ */
58
+ error(
59
+ /** 日志内容,可以有任意多个。 */
60
+ ...args: any[]
61
+ ): void
62
+ /** 在调试面板中创建一个新的分组
63
+ *
64
+ * **注意**
65
+ * 仅在工具中有效,在 vConsole 中为空函数实现。
66
+ * @supported weapp, harmony_hybrid
67
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html
68
+ */
69
+ group(
70
+ /** 分组标记 */
71
+ label?: string,
72
+ ): void
73
+ /** 结束由 [console.group](#group) 创建的分组
74
+ *
75
+ * **注意**
76
+ * 仅在工具中有效,在 vConsole 中为空函数实现。
77
+ * @supported weapp, harmony_hybrid
78
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html
79
+ */
80
+ groupEnd(): void
81
+ /** 向调试面板中打印 info 日志
82
+ * @supported weapp, harmony_hybrid
83
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html
84
+ */
85
+ info(
86
+ /** 日志内容,可以有任意多个。 */
87
+ ...args: any[]
88
+ ): void
89
+ /** 向调试面板中打印 log 日志
90
+ * @supported weapp, tt, harmony_hybrid
91
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html
92
+ */
93
+ log(
94
+ /** 日志内容,可以有任意多个。 */
95
+ ...args: any[]
96
+ ): void
97
+ /** 向调试面板中打印 warn 日志
98
+ * @supported weapp, harmony_hybrid
99
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html
100
+ */
101
+ warn(
102
+ /** 日志内容,可以有任意多个。 */
103
+ ...args: any[]
104
+ ): void
105
+ }
106
+
107
+ /**
108
+ * 日志管理器实例,可以通过 Taro.getLogManager 获取。
109
+ *
110
+ * 使用说明
111
+ * 最多保存5M的日志内容,超过5M后,旧的日志内容会被删除。
112
+ * 对于小程序,用户可以通过使用 button 组件的 open-type="feedback" 来上传打印的日志。
113
+ * 对于小游戏,用户可以通过使用 Taro.createFeedbackButton 来创建上传打印的日志的按钮。
114
+ * 开发者可以通过小程序管理后台左侧菜单“反馈管理”页面查看相关打印日志。
115
+ *
116
+ * 基础库默认会把 App、Page 的生命周期函数和 wx 命名空间下的函数调用写入日志。
117
+ * @supported weapp
118
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.html
119
+ */
120
+ interface LogManager {
121
+ /** 写 debug 日志
122
+ * @supported weapp
123
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html
124
+ */
125
+ debug(
126
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
127
+ ...args: any[]
128
+ ): void
129
+ /** 写 info 日志
130
+ * @supported weapp
131
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html
132
+ */
133
+ info(
134
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
135
+ ...args: any[]
136
+ ): void
137
+ /** 写 log 日志
138
+ * @supported weapp
139
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html
140
+ */
141
+ log(
142
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
143
+ ...args: any[]
144
+ ): void
145
+ /** 写 warn 日志
146
+ * @supported weapp
147
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html
148
+ */
149
+ warn(
150
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
151
+ ...args: any[]
152
+ ): void
153
+ }
154
+
155
+ /**
156
+ * 实时日志管理器实例,可以通过 Taro.getRealtimeLogManager 获取。
157
+ *
158
+ * 使用说明
159
+ * 为帮助小程序开发者快捷地排查小程序漏洞、定位问题,我们推出了实时日志功能。从基础库2.7.1开始,开发者可通过提供的接口打印日志,日志汇聚并实时上报到小程序后台。
160
+ * 开发者可从小程序管理后台“开发->运维中心->实时日志”进入日志查询页面,查看开发者打印的日志信息。
161
+ * @supported weapp
162
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.html
163
+ */
164
+
165
+ interface RealtimeLogManager {
166
+ /** 添加过滤关键字
167
+ * @supported weapp
168
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html
169
+ */
170
+ addFilterMsg(
171
+ /** 是 setFilterMsg 的添加接口。用于设置多个过滤关键字。 */
172
+ msg: string
173
+ ): void
174
+ /** 写 error 日志
175
+ * @supported weapp
176
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html
177
+ */
178
+ error(
179
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
180
+ ...args: any[]
181
+ ): void
182
+ /** 设置实时日志page参数所在的页面
183
+ * @supported weapp
184
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.in.html
185
+ */
186
+ in(
187
+ /** page 实例 */
188
+ pageInstance
189
+ ): void
190
+ /** 写 info 日志
191
+ * @supported weapp
192
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html
193
+ */
194
+ info(
195
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
196
+ ...args: any[]
197
+ ): void
198
+ /** 设置过滤关键字
199
+ * @supported weapp
200
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.setFilterMsg.html
201
+ */
202
+ setFilterMsg(
203
+ /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
204
+ msg: string
205
+ ): void
206
+ /** 获取给定标签的日志管理器实例,目前只支持在插件使用
207
+ * @supported weapp
208
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.tag.html
209
+ */
210
+ tag(
211
+ /** 标签名 */
212
+ tagName: string
213
+ ): RealtimeTagLogManager
214
+ /** 写 warn 日志
215
+ * @supported weapp
216
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html
217
+ */
218
+ warn(
219
+ /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
220
+ ...args: any[]
221
+ ): void
222
+ }
223
+
224
+ /** 给定标签的实时日志管理器实例,可以通过 给定标签的实时日志管理器实例,可以通过 [RealtimeLogManager.tag](./RealtimeLogManager#tag) 接口获取,目前只支持在插件使用。 接口获取,目前只支持在插件使用。
225
+ *
226
+ * **使用说明**
227
+ * RealtimeTagLogManager 功能和 [RealtimeLogManager](./RealtimeLogManager) 相似,但是为了让输出的实时日志更易于分析,其具有更严格的格式要求。
228
+ * RealtimeTagLogManager 使用时需要传入标签,调用该实例所输出的日志均会被汇集到对应标签下,同时该实例的日志只支持 key-value 格式进行输出。
229
+ * @supported weapp
230
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.html
231
+ */
232
+ interface RealtimeTagLogManager {
233
+ /** 添加过滤关键字
234
+ * @supported weapp
235
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.addFilterMsg.html
236
+ */
237
+ addFilterMsg(
238
+ /** 是 setFilterMsg 的添加接口。用于设置多个过滤关键字。 */
239
+ msg: string
240
+ ): void
241
+ /** 写 error 日志
242
+ * @supported weapp
243
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.error.html
244
+ */
245
+ error(
246
+ /** 日志的 key */
247
+ key: string,
248
+ /** 日志的 key */
249
+ value: Object | any[] | number | string,
250
+ ): void
251
+ /** 写 info 日志
252
+ * @supported weapp
253
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.info.html
254
+ */
255
+ info(
256
+ /** 日志的 key */
257
+ key: string,
258
+ /** 日志的 key */
259
+ value: Object | any[] | number | string,
260
+ ): void
261
+ /** 设置过滤关键字
262
+ * @supported weapp
263
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.setFilterMsg.html
264
+ */
265
+ setFilterMsg(
266
+ /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
267
+ msg: string
268
+ ): void
269
+ /** 写 warn 日志
270
+ * @supported weapp
271
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.warn.html
272
+ */
273
+ warn(
274
+ /** 日志的 key */
275
+ key: string,
276
+ /** 日志的 key */
277
+ value: Object | any[] | number | string,
278
+ ): void
279
+ }
280
+
281
+ interface TaroStatic {
282
+ /**
283
+ * 设置是否打开调试开关,此开关对正式版也能生效。
284
+ * @supported weapp
285
+ * @example
286
+ * ```tsx
287
+ * // 打开调试
288
+ * Taro.setEnableDebug({
289
+ * enableDebug: true
290
+ * })
291
+ * // 关闭调试
292
+ * Taro.setEnableDebug({
293
+ * enableDebug: false
294
+ * })
295
+ * ```
296
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html
297
+ */
298
+ setEnableDebug(res: setEnableDebug.Option): Promise<setEnableDebug.Promised>
299
+
300
+ /**
301
+ * 获取实时日志管理器对象。
302
+ * @supported weapp
303
+ * @example
304
+ * ```tsx
305
+ * const logger = Taro.getRealtimeLogManager()
306
+ * logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
307
+ * logger.error({str: 'hello world'}, 'error log', 100, [1, 2, 3])
308
+ * logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
309
+ * ```
310
+ */
311
+ getRealtimeLogManager(): RealtimeLogManager
312
+
313
+ /**
314
+ * 获取日志管理器对象。
315
+ * @supported weapp
316
+ * @example
317
+ * ```tsx
318
+ * const logger = Taro.getLogManager({level: 1})
319
+ *
320
+ * logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3])
321
+ * logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
322
+ * logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
323
+ * logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
324
+ * ```
325
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html
326
+ */
327
+ getLogManager(res?: getLogManager.Option): LogManager
328
+ }
329
+ }
@@ -0,0 +1,19 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ interface TaroStatic {
5
+ /**
6
+ * @supported weapp, h5, rn, harmony_hybrid
7
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/env/envObj.html
8
+ */
9
+ env: {
10
+ [key: string]: string | undefined
11
+ /** 框架 */
12
+ FRAMEWORK: 'react' | 'preact' | 'solid' | 'vue3'
13
+ /** Taro 环境变量 */
14
+ TARO_ENV: 'weapp' | 'h5' | 'rn' | 'swan' | 'alipay' | 'tt' | 'qq' | 'jd' | 'quickapp'
15
+ /** 文件系统中的用户目录路径 (本地路径) */
16
+ USER_DATA_PATH?: string
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,102 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ interface TaroStatic {
5
+ /** 判断小程序的 API,回调,参数,组件等是否在当前版本可用。
6
+ * @supported weapp, tt, h5, harmony_hybrid
7
+ * @example
8
+ * ```tsx
9
+ * Taro.canIUse('openBluetoothAdapter')
10
+ * Taro.canIUse('getSystemInfoSync.return.screenWidth')
11
+ * Taro.canIUse('getSystemInfo.success.screenWidth')
12
+ * Taro.canIUse('showToast.object.image')
13
+ * Taro.canIUse('onCompassChange.callback.direction')
14
+ * Taro.canIUse('request.object.method.GET')
15
+ * Taro.canIUse('live-player')
16
+ * Taro.canIUse('text.selectable')
17
+ * Taro.canIUse('button.open-type.contact')
18
+ * ```
19
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html
20
+ */
21
+ canIUse(
22
+ /**
23
+ * 使用 `${API}.${method}.${param}.${option}` 或者 `${component}.${attribute}.${option}` 方式来调用
24
+ *
25
+ * **参数说明**
26
+ *
27
+ * - `${API}` 代表 API 名字
28
+ * - `${method}` 代表调用方式,有效值为return, success, object, callback
29
+ * - `${param}` 代表参数或者返回值
30
+ * - `${option}` 代表参数的可选值或者返回值的属性
31
+ * - `${component}` 代表组件名字
32
+ * - `${attribute}` 代表组件属性
33
+ * - `${option}` 代表组件属性的可选值
34
+ */
35
+ schema: string
36
+ ): boolean
37
+
38
+ /** 判断能否使用 WebP 格式
39
+ *
40
+ * > 在小程序平台中仅在 android 和 devtools 设备时可用
41
+ * @supported global
42
+ */
43
+ canIUseWebp(): boolean
44
+
45
+ /**
46
+ * 将 Base64 字符串转成 ArrayBuffer 数据。
47
+ * @supported weapp, h5, rn, tt, harmony_hybrid
48
+ * @example
49
+ * ```tsx
50
+ * const base64 = 'CxYh'
51
+ * const arrayBuffer = Taro.base64ToArrayBuffer(base64)
52
+ * ```
53
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.base64ToArrayBuffer.html
54
+ */
55
+ base64ToArrayBuffer (
56
+ /** 要转化成 ArrayBuffer 对象的 Base64 字符串 */
57
+ base64: string,
58
+ ): ArrayBuffer
59
+
60
+ /**
61
+ * 将 ArrayBuffer 数据转成 Base64 字符串。
62
+ * @supported weapp, h5, rn, tt, harmony_hybrid
63
+ * @example
64
+ * ```tsx
65
+ * const arrayBuffer = new Uint8Array([11, 22, 33])
66
+ * const base64 = Taro.arrayBufferToBase64(arrayBuffer)
67
+ * ```
68
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.arrayBufferToBase64.html
69
+ */
70
+ arrayBufferToBase64 (
71
+ /** 要转换成 Base64 字符串的 ArrayBuffer 对象 */
72
+ buffer: ArrayBuffer,
73
+ ): string
74
+
75
+ /**
76
+ * 跳转预加载 API
77
+ * @param options 预加载的数据
78
+ * @example
79
+ * ```tsx
80
+ * Taro.preload({ key: 'value' })
81
+ * ```
82
+ */
83
+ preload (options: Record<string, any>)
84
+
85
+ /**
86
+ * 跳转预加载 API
87
+ * @param key 预加载的数据 key
88
+ * @param value 预加载的数据 value
89
+ * @example
90
+ * ```tsx
91
+ * Taro.preload('key', 'value')
92
+ * ```
93
+ */
94
+ preload (key: string, value: any)
95
+
96
+ /**
97
+ * 预加载的数据
98
+ * @ignore
99
+ */
100
+ preloadData: Record<string, any>
101
+ }
102
+ }