@ray-js/api 1.6.8 → 1.6.9

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.
@@ -1,44 +1,16 @@
1
- declare enum HighwayMethod {
2
- /** HTTP 请求 OPTIONS */
3
- OPTIONS = 'OPTIONS',
4
-
5
- /** HTTP 请求 GET */
6
- GET = 'GET',
7
-
8
- /** HTTP 请求 HEAD */
9
- HEAD = 'HEAD',
10
-
11
- /** HTTP 请求 POST */
12
- POST = 'POST',
13
-
14
- /** HTTP 请求 PUT */
15
- PUT = 'PUT',
16
-
17
- /** HTTP 请求 DELETE */
18
- DELETE = 'DELETE',
19
-
20
- /** HTTP 请求 TRACE */
21
- TRACE = 'TRACE',
22
-
23
- /** HTTP 请求 TRACE */
24
- CONNECT = 'CONNECT',
25
- }
26
-
27
1
  /**
28
2
  * MiniKit
29
3
  *
30
- * @version 3.12.1
4
+ * @version 3.14.1
31
5
  */
32
6
  declare namespace ty {
33
7
  /**
34
- * 特殊方法:是否异层渲染响应
35
- */
8
+ *@description 特殊方法:是否异层渲染响应*/
36
9
  export function nativeDisabled(params: {
37
10
  /** 禁用异层渲染手势分发 */
38
11
  nativeDisabled: boolean
39
12
  /** 需要禁止或启用手势分发的页面id */
40
13
  pageId: string
41
- complete?: () => void
42
14
  success?: (params: string) => void
43
15
  fail?: (params: {
44
16
  errorMsg: string
@@ -48,11 +20,11 @@ declare namespace ty {
48
20
  errorMsg: string
49
21
  }
50
22
  }) => void
23
+ complete?: () => void
51
24
  }): void
52
25
 
53
26
  /**
54
- * 通用方法:调用组件API
55
- */
27
+ *@description 通用方法:用于基础库给原生异层渲染组件发送消息*/
56
28
  export function nativeInovke(params: {
57
29
  /** 原生组件类型 */
58
30
  type?: number
@@ -63,8 +35,7 @@ declare namespace ty {
63
35
  /** 小程序页面id */
64
36
  pageId: string
65
37
  /** 参数等 */
66
- params: Record<string, string>
67
- complete?: () => void
38
+ params: any
68
39
  success?: (params: {}) => void
69
40
  fail?: (params: {
70
41
  errorMsg: string
@@ -74,16 +45,15 @@ declare namespace ty {
74
45
  errorMsg: string
75
46
  }
76
47
  }) => void
48
+ complete?: () => void
77
49
  }): void
78
50
 
79
51
  /**
80
- * 获取权限的配置信息
81
- */
52
+ *@description 获取权限的配置信息*/
82
53
  export function getPermissionConfig(params?: {
83
- complete?: () => void
84
54
  success?: (params: {
85
55
  /** 权限相关配置信息 */
86
- result: Record<string, any>
56
+ result: any
87
57
  }) => void
88
58
  fail?: (params: {
89
59
  errorMsg: string
@@ -93,24 +63,22 @@ declare namespace ty {
93
63
  errorMsg: string
94
64
  }
95
65
  }) => void
66
+ complete?: () => void
96
67
  }): void
97
68
 
98
69
  /**
99
- * 获取权限的配置信息
100
- */
70
+ *@description 获取权限的配置信息*/
101
71
  export function getPermissionConfigSync(): {
102
72
  /** 权限相关配置信息 */
103
- result: Record<string, any>
73
+ result: any
104
74
  }
105
75
 
106
76
  /**
107
- * 调起客户端小程序设置界面,返回用户设置的操作结果。
108
- */
77
+ *@description 调起客户端小程序设置界面,返回用户设置的操作结果。*/
109
78
  export function openSetting(params?: {
110
- complete?: () => void
111
79
  success?: (params: {
112
80
  /** 用户授权设置信息 */
113
- scope: Record<string, boolean>
81
+ scope: any
114
82
  }) => void
115
83
  fail?: (params: {
116
84
  errorMsg: string
@@ -120,15 +88,16 @@ declare namespace ty {
120
88
  errorMsg: string
121
89
  }
122
90
  }) => void
91
+ complete?: () => void
123
92
  }): void
124
93
 
125
94
  /**
126
- * 设置调试模式
127
- */
95
+ *@description 设置vconsole调试模式开关
96
+ *true: 开启vconsole
97
+ *false: 关闭vconsole*/
128
98
  export function changeDebugMode(params: {
129
99
  /** 调试模式开关 */
130
100
  isEnable: boolean
131
- complete?: () => void
132
101
  success?: (params: null) => void
133
102
  fail?: (params: {
134
103
  errorMsg: string
@@ -138,13 +107,13 @@ declare namespace ty {
138
107
  errorMsg: string
139
108
  }
140
109
  }) => void
110
+ complete?: () => void
141
111
  }): void
142
112
 
143
113
  /**
144
- * 打开帮助中心,默认:面板小程序会跳转到面板帮助中心,普通小程序会跳转到App帮助中心
145
- */
114
+ *@description 打开帮助中心,默认:面板小程序会跳转到面板帮助中心,普通小程序会跳转到App帮助中心
115
+ *@error {7: 'API Internal processing failed'}*/
146
116
  export function openHelpCenter(params?: {
147
- complete?: () => void
148
117
  success?: (params: null) => void
149
118
  fail?: (params: {
150
119
  errorMsg: string
@@ -154,15 +123,15 @@ declare namespace ty {
154
123
  errorMsg: string
155
124
  }
156
125
  }) => void
126
+ complete?: () => void
157
127
  }): void
158
128
 
159
129
  /**
160
- * 显示 tabBar 某一项的右上角的红点
161
- */
130
+ *@description 显示 tabBar 某一项的右上角的红点
131
+ *@error {40008: 'no tab config'}*/
162
132
  export function showTabBarRedDot(params: {
163
133
  /** tabBar 的哪一项,从左边算起 */
164
134
  index: number
165
- complete?: () => void
166
135
  success?: (params: null) => void
167
136
  fail?: (params: {
168
137
  errorMsg: string
@@ -172,15 +141,15 @@ declare namespace ty {
172
141
  errorMsg: string
173
142
  }
174
143
  }) => void
144
+ complete?: () => void
175
145
  }): void
176
146
 
177
147
  /**
178
- * 显示 tabBar
179
- */
148
+ *@description 显示 tabBar
149
+ *@error {40008: 'no tab config'}*/
180
150
  export function showTabBar(params: {
181
151
  /** 是否需要动画效果 */
182
152
  animation: boolean
183
- complete?: () => void
184
153
  success?: (params: null) => void
185
154
  fail?: (params: {
186
155
  errorMsg: string
@@ -190,11 +159,12 @@ declare namespace ty {
190
159
  errorMsg: string
191
160
  }
192
161
  }) => void
162
+ complete?: () => void
193
163
  }): void
194
164
 
195
165
  /**
196
- * 动态设置 tabBar 的整体样式
197
- */
166
+ *@description 动态设置 tabBar 的整体样式
167
+ *@error {40008: 'no tab config'}*/
198
168
  export function setTabBarStyle(params: {
199
169
  /** tab 上的文字默认颜色 */
200
170
  color: string
@@ -204,7 +174,6 @@ declare namespace ty {
204
174
  backgroundColor: string
205
175
  /** tabBar上边框的颜色, 仅支持 black/white */
206
176
  borderStyle: string
207
- complete?: () => void
208
177
  success?: (params: null) => void
209
178
  fail?: (params: {
210
179
  errorMsg: string
@@ -214,11 +183,12 @@ declare namespace ty {
214
183
  errorMsg: string
215
184
  }
216
185
  }) => void
186
+ complete?: () => void
217
187
  }): void
218
188
 
219
189
  /**
220
- * 动态设置 tabBar 某一项的内容
221
- */
190
+ *@description 动态设置 tabBar 某一项的内容
191
+ *@error {40008: 'no tab config'}*/
222
192
  export function setTabBarItem(params: {
223
193
  /** tabBar 的哪一项,从左边算起 */
224
194
  index: number
@@ -228,7 +198,6 @@ declare namespace ty {
228
198
  iconPath: string
229
199
  /** 选中时的图片路径 */
230
200
  selectedIconPath: string
231
- complete?: () => void
232
201
  success?: (params: null) => void
233
202
  fail?: (params: {
234
203
  errorMsg: string
@@ -238,17 +207,17 @@ declare namespace ty {
238
207
  errorMsg: string
239
208
  }
240
209
  }) => void
210
+ complete?: () => void
241
211
  }): void
242
212
 
243
213
  /**
244
- * 为 tabBar 某一项的右上角添加文本
245
- */
214
+ *@description 为 tabBar 某一项的右上角添加文本
215
+ *@error {40008: 'no tab config'}*/
246
216
  export function setTabBarBadge(params: {
247
217
  /** tabBar 的哪一项,从左边算起 */
248
218
  index: number
249
219
  /** 显示的文本,超过 4 个字符则显示成 ... */
250
220
  text: string
251
- complete?: () => void
252
221
  success?: (params: null) => void
253
222
  fail?: (params: {
254
223
  errorMsg: string
@@ -258,17 +227,15 @@ declare namespace ty {
258
227
  errorMsg: string
259
228
  }
260
229
  }) => void
230
+ complete?: () => void
261
231
  }): void
262
232
 
263
233
  /**
264
- * 移除 tabBar 某一项右上角的文本
265
- */
234
+ *@description 移除 tabBar 某一项右上角的文本
235
+ *@error {40008: 'no tab config'}*/
266
236
  export function removeTabBarBadge(params: {
267
237
  /** tabBar 的哪一项,从左边算起 */
268
238
  index: number
269
- /** 显示的文本,超过 4 个字符则显示成 ... */
270
- text: string
271
- complete?: () => void
272
239
  success?: (params: null) => void
273
240
  fail?: (params: {
274
241
  errorMsg: string
@@ -278,15 +245,15 @@ declare namespace ty {
278
245
  errorMsg: string
279
246
  }
280
247
  }) => void
248
+ complete?: () => void
281
249
  }): void
282
250
 
283
251
  /**
284
- * 隐藏 tabBar 某一项的右上角的红点
285
- */
252
+ *@description 隐藏 tabBar 某一项的右上角的红点
253
+ *@error {40008: 'no tab config'}*/
286
254
  export function hideTabBarRedDot(params: {
287
255
  /** tabBar 的哪一项,从左边算起 */
288
256
  index: number
289
- complete?: () => void
290
257
  success?: (params: null) => void
291
258
  fail?: (params: {
292
259
  errorMsg: string
@@ -296,15 +263,15 @@ declare namespace ty {
296
263
  errorMsg: string
297
264
  }
298
265
  }) => void
266
+ complete?: () => void
299
267
  }): void
300
268
 
301
269
  /**
302
- * 隐藏 tabBar
303
- */
270
+ *@description 隐藏 tabBar
271
+ *@error {40008: 'no tab config'}*/
304
272
  export function hideTabBar(params: {
305
273
  /** 是否需要动画效果 */
306
274
  animation: boolean
307
- complete?: () => void
308
275
  success?: (params: null) => void
309
276
  fail?: (params: {
310
277
  errorMsg: string
@@ -314,26 +281,23 @@ declare namespace ty {
314
281
  errorMsg: string
315
282
  }
316
283
  }) => void
284
+ complete?: () => void
317
285
  }): void
318
286
 
319
287
  /**
320
- * 发起highway请求
321
- */
288
+ *@description 发起highway请求
289
+ *@error {5: 'The necessary parameters are missing'} | {40015: 'miniapp highway request error'}*/
322
290
  export function apiRequestByHighway(params: {
323
291
  /** api 名称 */
324
292
  api: string
325
293
  /** data 请求入参 */
326
- data?: Record<string, any>
294
+ data?: any
327
295
  /** method 请求方法 */
328
296
  method?: HighwayMethod
329
- complete?: () => void
330
297
  success?: (params: {
331
- /**
332
- * 请求结果
333
- * thing_data_ 出参结构体, JSON序列化
334
- */
298
+ /** 接口返回数据的序列化对象,序列化失败时为null */
335
299
  thing_json_?: {}
336
- /** 元数据 */
300
+ /** 接口返回的原始数据 */
337
301
  data: string
338
302
  }) => void
339
303
  fail?: (params: {
@@ -344,15 +308,15 @@ declare namespace ty {
344
308
  errorMsg: string
345
309
  }
346
310
  }) => void
311
+ complete?: () => void
347
312
  }): void
348
313
 
349
314
  /**
350
- * 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
351
- */
315
+ *@description 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
316
+ *@error {7: 'API Internal processing failed'} | {40003: 'miniapp not exist'}*/
352
317
  export function navigateBackMiniProgram(params?: {
353
318
  /** 需要返回给上一个小程序的数据,上一个小程序可在 App.onShow 中获取到这份数据 */
354
- extraData?: Record<string, any>
355
- complete?: () => void
319
+ extraData?: any
356
320
  success?: (params: null) => void
357
321
  fail?: (params: {
358
322
  errorMsg: string
@@ -362,13 +326,13 @@ declare namespace ty {
362
326
  errorMsg: string
363
327
  }
364
328
  }) => void
329
+ complete?: () => void
365
330
  }): void
366
331
 
367
332
  /**
368
- * 退出当前小程序
369
- */
333
+ *@description 退出当前小程序
334
+ *@error {40003: 'miniapp not exist'} | {40010: 'miniapp can not be exit'}*/
370
335
  export function exitMiniProgram(params?: {
371
- complete?: () => void
372
336
  success?: (params: null) => void
373
337
  fail?: (params: {
374
338
  errorMsg: string
@@ -378,18 +342,20 @@ declare namespace ty {
378
342
  errorMsg: string
379
343
  }
380
344
  }) => void
345
+ complete?: () => void
381
346
  }): void
382
347
 
383
348
  /**
384
- * 获取小程序启动时的参数。与App.onLaunch的回调参数一致。
385
- */
349
+ *@description 获取小程序启动时的参数。与App.onLaunch的回调参数一致。
350
+ *@error {7: 'API Internal processing failed'}*/
386
351
  export function getLaunchOptions(params?: {
387
- complete?: () => void
388
352
  success?: (params: {
389
353
  /** 启动小程序的路径 (代码包路径) */
390
354
  path: string
355
+ /** 启动小程序的场景值 */
356
+ scene?: MiniAppScene
391
357
  /** 启动小程序的 query 参数 */
392
- query: Record<string, any>
358
+ query: any
393
359
  /** 分享转发 */
394
360
  referrerInfo: ReferrerInfo
395
361
  /** API 类别: default 默认类别; embedded 内嵌,通过打开半屏小程序能力打开的小程序 */
@@ -403,16 +369,19 @@ declare namespace ty {
403
369
  errorMsg: string
404
370
  }
405
371
  }) => void
372
+ complete?: () => void
406
373
  }): void
407
374
 
408
375
  /**
409
- * 获取小程序启动时的参数。与App.onLaunch的回调参数一致。
410
- */
376
+ *@description 获取小程序启动时的参数。与App.onLaunch的回调参数一致。
377
+ *@error {7: 'API Internal processing failed'}*/
411
378
  export function getLaunchOptionsSync(): {
412
379
  /** 启动小程序的路径 (代码包路径) */
413
380
  path: string
381
+ /** 启动小程序的场景值 */
382
+ scene?: MiniAppScene
414
383
  /** 启动小程序的 query 参数 */
415
- query: Record<string, any>
384
+ query: any
416
385
  /** 分享转发 */
417
386
  referrerInfo: ReferrerInfo
418
387
  /** API 类别: default 默认类别; embedded 内嵌,通过打开半屏小程序能力打开的小程序 */
@@ -420,15 +389,16 @@ declare namespace ty {
420
389
  }
421
390
 
422
391
  /**
423
- * 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与App.onLaunch的回调参数一致;如果当前是热启动,则返回值与App.onShow 一致。
424
- */
392
+ *@description 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与App.onLaunch的回调参数一致;如果当前是热启动,则返回值与App.onShow 一致。
393
+ *@error {7: 'API Internal processing failed'}*/
425
394
  export function getEnterOptions(params?: {
426
- complete?: () => void
427
395
  success?: (params: {
428
396
  /** 启动小程序的路径 (代码包路径) */
429
397
  path: string
398
+ /** 启动小程序的场景值 */
399
+ scene?: MiniAppScene
430
400
  /** 启动小程序的 query 参数 */
431
- query: Record<string, any>
401
+ query: any
432
402
  /** 分享转发 */
433
403
  referrerInfo: ReferrerInfo
434
404
  /** API 类别: default 默认类别; embedded 内嵌,通过打开半屏小程序能力打开的小程序 */
@@ -442,16 +412,19 @@ declare namespace ty {
442
412
  errorMsg: string
443
413
  }
444
414
  }) => void
415
+ complete?: () => void
445
416
  }): void
446
417
 
447
418
  /**
448
- * 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与App.onLaunch的回调参数一致;如果当前是热启动,则返回值与App.onShow 一致。
449
- */
419
+ *@description 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与App.onLaunch的回调参数一致;如果当前是热启动,则返回值与App.onShow 一致。
420
+ *@error {7: 'API Internal processing failed'}*/
450
421
  export function getEnterOptionsSync(): {
451
422
  /** 启动小程序的路径 (代码包路径) */
452
423
  path: string
424
+ /** 启动小程序的场景值 */
425
+ scene?: MiniAppScene
453
426
  /** 启动小程序的 query 参数 */
454
- query: Record<string, any>
427
+ query: any
455
428
  /** 分享转发 */
456
429
  referrerInfo: ReferrerInfo
457
430
  /** API 类别: default 默认类别; embedded 内嵌,通过打开半屏小程序能力打开的小程序 */
@@ -459,12 +432,11 @@ declare namespace ty {
459
432
  }
460
433
 
461
434
  /**
462
- * 小程序看板的标题,小程序名称,面板名称等
463
- */
435
+ *@description 设置小程序看板页标题,小程序名称,面板名称等
436
+ *@error {5: 'The necessary parameters are missing'}*/
464
437
  export function setBoardTitle(params: {
465
- /** 看板的标题 */
438
+ /** 看板页标题 */
466
439
  title: string
467
- complete?: () => void
468
440
  success?: (params: null) => void
469
441
  fail?: (params: {
470
442
  errorMsg: string
@@ -474,20 +446,20 @@ declare namespace ty {
474
446
  errorMsg: string
475
447
  }
476
448
  }) => void
449
+ complete?: () => void
477
450
  }): void
478
451
 
479
452
  /**
480
- * 小程序看板的标题,小程序名称,面板名称等
481
- */
453
+ *@description 设置小程序看板页标题,小程序名称,面板名称等
454
+ *@error {5: 'The necessary parameters are missing'}*/
482
455
  export function setBoardTitleSync(boardBean?: BoardBean): null
483
456
 
484
457
  /**
485
- * 小程序看板的icon,小程序icon,面板icon等
486
- */
458
+ *@description 设置小程序看板页icon,小程序icon,面板icon等
459
+ *@error {5: 'The necessary parameters are missing'}*/
487
460
  export function setBoardIcon(params: {
488
- /** 看板的icon */
461
+ /** 看板页icon */
489
462
  icon: string
490
- complete?: () => void
491
463
  success?: (params: null) => void
492
464
  fail?: (params: {
493
465
  errorMsg: string
@@ -497,18 +469,18 @@ declare namespace ty {
497
469
  errorMsg: string
498
470
  }
499
471
  }) => void
472
+ complete?: () => void
500
473
  }): void
501
474
 
502
475
  /**
503
- * 小程序看板的icon,小程序icon,面板icon等
504
- */
476
+ *@description 设置小程序看板页icon,小程序icon,面板icon等
477
+ *@error {5: 'The necessary parameters are missing'}*/
505
478
  export function setBoardIconSync(boardIconBean?: BoardIconBean): null
506
479
 
507
480
  /**
508
- * 显示小程序看板中的标题和icon
509
- */
481
+ *@description 显示小程序看板页的标题和icon
482
+ *@error {7: 'API Internal processing failed'}*/
510
483
  export function showBoardTitleIcon(params?: {
511
- complete?: () => void
512
484
  success?: (params: null) => void
513
485
  fail?: (params: {
514
486
  errorMsg: string
@@ -518,18 +490,18 @@ declare namespace ty {
518
490
  errorMsg: string
519
491
  }
520
492
  }) => void
493
+ complete?: () => void
521
494
  }): void
522
495
 
523
496
  /**
524
- * 显示小程序看板中的标题和icon
525
- */
497
+ *@description 显示小程序看板页的标题和icon
498
+ *@error {7: 'API Internal processing failed'}*/
526
499
  export function showBoardTitleIconSync(): null
527
500
 
528
501
  /**
529
- * 隐藏小程序看板中的标题和icon
530
- */
502
+ *@description 隐藏小程序看板页的标题和icon
503
+ *@error {7: 'API Internal processing failed'}*/
531
504
  export function hideBoardTitleIcon(params?: {
532
- complete?: () => void
533
505
  success?: (params: null) => void
534
506
  fail?: (params: {
535
507
  errorMsg: string
@@ -539,18 +511,18 @@ declare namespace ty {
539
511
  errorMsg: string
540
512
  }
541
513
  }) => void
514
+ complete?: () => void
542
515
  }): void
543
516
 
544
517
  /**
545
- * 隐藏小程序看板中的标题和icon
546
- */
518
+ *@description 隐藏小程序看板页的标题和icon
519
+ *@error {7: 'API Internal processing failed'}*/
547
520
  export function hideBoardTitleIconSync(): null
548
521
 
549
522
  /**
550
- * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
551
- */
523
+ *@description 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
524
+ *@error {7: 'API Internal processing failed'}*/
552
525
  export function getMenuButtonBoundingClientRect(params?: {
553
- complete?: () => void
554
526
  success?: (params: {
555
527
  /** 宽度,单位:px */
556
528
  width: number
@@ -573,11 +545,12 @@ declare namespace ty {
573
545
  errorMsg: string
574
546
  }
575
547
  }) => void
548
+ complete?: () => void
576
549
  }): void
577
550
 
578
551
  /**
579
- * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
580
- */
552
+ *@description 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
553
+ *@error {7: 'API Internal processing failed'}*/
581
554
  export function getMenuButtonBoundingClientRectSync(): {
582
555
  /** 宽度,单位:px */
583
556
  width: number
@@ -594,14 +567,13 @@ declare namespace ty {
594
567
  }
595
568
 
596
569
  /**
597
- * 预下载智能小程序,此接口仅供提供预下载普通智能小程序调用,面板小程序的预下载需要使用另外的接口。
598
- */
570
+ *@description 预下载智能小程序,此接口仅供提供预下载普通智能小程序调用,面板小程序的预下载需要使用另外的接口。
571
+ *@error {5: 'The necessary parameters are missing'} | {6: 'The parameter format is incorrect'} | {7: 'API Internal processing failed'}*/
599
572
  export function preDownloadMiniApp(params: {
600
573
  /** 小程序id */
601
574
  miniAppId: string
602
575
  /** 指定小程序版本(可选参数) */
603
576
  miniAppVersion?: string
604
- complete?: () => void
605
577
  success?: (params: null) => void
606
578
  fail?: (params: {
607
579
  errorMsg: string
@@ -611,15 +583,15 @@ declare namespace ty {
611
583
  errorMsg: string
612
584
  }
613
585
  }) => void
586
+ complete?: () => void
614
587
  }): void
615
588
 
616
589
  /**
617
- * 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、iot账号下的唯一标识(unionid)
618
- */
590
+ *@description 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、iot账号下的唯一标识(unionid)
591
+ *@error {8: 'Method Unauthorized access'} | {30001: 'atop request error'} | {40018: 'query auth code fail'}*/
619
592
  export function login(params?: {
620
593
  /** 超时时间,单位ms */
621
594
  timeout?: number
622
- complete?: () => void
623
595
  success?: (params: {
624
596
  /** 用户登录凭证(有效期五分钟) */
625
597
  code: string
@@ -632,15 +604,15 @@ declare namespace ty {
632
604
  errorMsg: string
633
605
  }
634
606
  }) => void
607
+ complete?: () => void
635
608
  }): void
636
609
 
637
610
  /**
638
- * 屏幕旋转设置,auto / portrait / landscape。pad模式下不支持屏幕旋转
639
- */
611
+ *@description 屏幕旋转设置,auto / portrait / landscape。pad模式下不支持屏幕旋转
612
+ *@error {5: 'The necessary parameters are missing'} | {8: 'Method Unauthorized access'} | {40021: 'this page is not support set orientation'}*/
640
613
  export function setPageOrientation(params: {
641
614
  /** 屏幕旋转设置, auto(暂不支持) / portrait / landscape */
642
615
  pageOrientation: string
643
- complete?: () => void
644
616
  success?: (params: null) => void
645
617
  fail?: (params: {
646
618
  errorMsg: string
@@ -650,13 +622,13 @@ declare namespace ty {
650
622
  errorMsg: string
651
623
  }
652
624
  }) => void
625
+ complete?: () => void
653
626
  }): void
654
627
 
655
628
  /**
656
- * 隐藏右上角胶囊按钮
657
- */
629
+ *@description 隐藏右上角胶囊按钮
630
+ *@error {40022: 'this page can not hide menu button'}*/
658
631
  export function hideMenuButton(params?: {
659
- complete?: () => void
660
632
  success?: (params: null) => void
661
633
  fail?: (params: {
662
634
  errorMsg: string
@@ -666,13 +638,13 @@ declare namespace ty {
666
638
  errorMsg: string
667
639
  }
668
640
  }) => void
641
+ complete?: () => void
669
642
  }): void
670
643
 
671
644
  /**
672
- * 显示右上角胶囊按钮
673
- */
645
+ *@description 显示右上角胶囊按钮
646
+ *@error {40022: 'this page can not hide menu button'}*/
674
647
  export function showMenuButton(params?: {
675
- complete?: () => void
676
648
  success?: (params: null) => void
677
649
  fail?: (params: {
678
650
  errorMsg: string
@@ -682,13 +654,13 @@ declare namespace ty {
682
654
  errorMsg: string
683
655
  }
684
656
  }) => void
657
+ complete?: () => void
685
658
  }): void
686
659
 
687
660
  /**
688
- * 显示手机状态栏
689
- */
661
+ *@description 显示手机状态栏
662
+ *@error {7: 'API Internal processing failed'}*/
690
663
  export function showStatusBar(params?: {
691
- complete?: () => void
692
664
  success?: (params: null) => void
693
665
  fail?: (params: {
694
666
  errorMsg: string
@@ -698,13 +670,13 @@ declare namespace ty {
698
670
  errorMsg: string
699
671
  }
700
672
  }) => void
673
+ complete?: () => void
701
674
  }): void
702
675
 
703
676
  /**
704
- * 隐藏手机状态栏
705
- */
677
+ *@description 隐藏手机状态栏
678
+ *@error {7: 'API Internal processing failed'}*/
706
679
  export function hideStatusBar(params?: {
707
- complete?: () => void
708
680
  success?: (params: null) => void
709
681
  fail?: (params: {
710
682
  errorMsg: string
@@ -714,13 +686,13 @@ declare namespace ty {
714
686
  errorMsg: string
715
687
  }
716
688
  }) => void
689
+ complete?: () => void
717
690
  }): void
718
691
 
719
692
  /**
720
- * 关闭小部件
721
- */
693
+ *@description 关闭小部件
694
+ *@error {7: 'API Internal processing failed'}*/
722
695
  export function exitMiniWidget(params?: {
723
- complete?: () => void
724
696
  success?: (params: null) => void
725
697
  fail?: (params: {
726
698
  errorMsg: string
@@ -730,15 +702,15 @@ declare namespace ty {
730
702
  errorMsg: string
731
703
  }
732
704
  }) => void
705
+ complete?: () => void
733
706
  }): void
734
707
 
735
708
  /**
736
- * 判断设备上是否有已经安装相应应用或可以处理URL的程序,返回结果是一个对象,只有一个参数,格式为Boolean值。
737
- */
709
+ *@description 判断设备上是否有已经安装相应应用或可以处理URL的程序,返回结果是一个对象,只有一个参数,格式为Boolean值。
710
+ *@error {7: 'API Internal processing failed'}*/
738
711
  export function canOpenURL(params: {
739
712
  /** 要打开的url */
740
713
  url: string
741
- complete?: () => void
742
714
  success?: (params: {
743
715
  /** 是否支持打开对应的url */
744
716
  isCanOpen?: boolean
@@ -751,23 +723,23 @@ declare namespace ty {
751
723
  errorMsg: string
752
724
  }
753
725
  }) => void
726
+ complete?: () => void
754
727
  }): void
755
728
 
756
729
  /**
757
- * 判断设备上是否有已经安装相应应用或可以处理URL的程序,返回结果是一个对象,只有一个参数,格式为Boolean值。
758
- */
730
+ *@description 判断设备上是否有已经安装相应应用或可以处理URL的程序,返回结果是一个对象,只有一个参数,格式为Boolean值。
731
+ *@error {7: 'API Internal processing failed'}*/
759
732
  export function canOpenURLSync(openURLBean?: OpenURLBean): {
760
733
  /** 是否支持打开对应的url */
761
734
  isCanOpen?: boolean
762
735
  }
763
736
 
764
737
  /**
765
- * 打开设备上的某个应用或可以处理URL的程序。
766
- */
738
+ *@description 打开设备上的某个应用或可以处理URL的程序。
739
+ *@error {40026: 'open url fail, not exist app can open it.'}*/
767
740
  export function openURL(params: {
768
741
  /** 要打开的url */
769
742
  url: string
770
- complete?: () => void
771
743
  success?: (params: null) => void
772
744
  fail?: (params: {
773
745
  errorMsg: string
@@ -777,13 +749,13 @@ declare namespace ty {
777
749
  errorMsg: string
778
750
  }
779
751
  }) => void
752
+ complete?: () => void
780
753
  }): void
781
754
 
782
755
  /**
783
- * 获取小程序账号信息
784
- */
756
+ *@description 获取小程序账号信息
757
+ *@error {7: 'API Internal processing failed'}*/
785
758
  export function getAccountInfo(params?: {
786
- complete?: () => void
787
759
  success?: (params: {
788
760
  /** 小程序账号信息 */
789
761
  miniProgram: MiniProgramAccountInfo
@@ -796,21 +768,21 @@ declare namespace ty {
796
768
  errorMsg: string
797
769
  }
798
770
  }) => void
771
+ complete?: () => void
799
772
  }): void
800
773
 
801
774
  /**
802
- * 获取小程序账号信息
803
- */
775
+ *@description 获取小程序账号信息
776
+ *@error {7: 'API Internal processing failed'}*/
804
777
  export function getAccountInfoSync(): {
805
778
  /** 小程序账号信息 */
806
779
  miniProgram: MiniProgramAccountInfo
807
780
  }
808
781
 
809
782
  /**
810
- * 获取小程序自定义配置
811
- */
783
+ *@description 获取小程序自定义配置
784
+ *@error {7: 'API Internal processing failed'}*/
812
785
  export function getMiniAppConfig(params?: {
813
- complete?: () => void
814
786
  success?: (params: {
815
787
  /** 小程序自定义配置 */
816
788
  config: {}
@@ -823,21 +795,21 @@ declare namespace ty {
823
795
  errorMsg: string
824
796
  }
825
797
  }) => void
798
+ complete?: () => void
826
799
  }): void
827
800
 
828
801
  /**
829
- * 获取小程序自定义配置
830
- */
802
+ *@description 获取小程序自定义配置
803
+ *@error {7: 'API Internal processing failed'}*/
831
804
  export function getMiniAppConfigSync(): {
832
805
  /** 小程序自定义配置 */
833
806
  config: {}
834
807
  }
835
808
 
836
809
  /**
837
- * 唤起小程序看板页
838
- */
810
+ *@description 唤起小程序看板页
811
+ *@error {7: 'API Internal processing failed'}*/
839
812
  export function showBoard(params?: {
840
- complete?: () => void
841
813
  success?: (params: null) => void
842
814
  fail?: (params: {
843
815
  errorMsg: string
@@ -847,17 +819,17 @@ declare namespace ty {
847
819
  errorMsg: string
848
820
  }
849
821
  }) => void
822
+ complete?: () => void
850
823
  }): void
851
824
 
852
825
  /**
853
- * 重置小程序看板页自定义栏item
854
- */
826
+ *@description 重置小程序看板页自定义栏item
827
+ *@error {5: 'The necessary parameters are missing'}*/
855
828
  export function resetBoardMenus(params: {
856
829
  /** 生效页面, 默认当前页面 */
857
830
  effectPage?: EffectPage
858
831
  /** item列表 */
859
832
  menus: BoardItemBean[]
860
- complete?: () => void
861
833
  success?: (params: null) => void
862
834
  fail?: (params: {
863
835
  errorMsg: string
@@ -867,17 +839,17 @@ declare namespace ty {
867
839
  errorMsg: string
868
840
  }
869
841
  }) => void
842
+ complete?: () => void
870
843
  }): void
871
844
 
872
845
  /**
873
- * 重置小程序看板页默认栏item
874
- */
846
+ *@description 重置小程序看板页默认栏item
847
+ *@error {5: 'The necessary parameters are missing'}*/
875
848
  export function resetSystemMenus(params: {
876
849
  /** 生效页面, 默认当前页面 */
877
850
  effectPage?: EffectPage
878
851
  /** item列表 */
879
852
  menus: BoardItemBean[]
880
- complete?: () => void
881
853
  success?: (params: null) => void
882
854
  fail?: (params: {
883
855
  errorMsg: string
@@ -887,17 +859,17 @@ declare namespace ty {
887
859
  errorMsg: string
888
860
  }
889
861
  }) => void
862
+ complete?: () => void
890
863
  }): void
891
864
 
892
865
  /**
893
- * 针对具体的看板itemKey显示红点
894
- */
866
+ *@description 针对具体的看板itemKey显示红点
867
+ *@error {7: 'API Internal processing failed'}*/
895
868
  export function showRedBot(params: {
896
869
  /** 生效页面, 默认当前页面 */
897
870
  effectPage?: EffectPage
898
871
  /** 看板item名称 */
899
872
  key: string
900
- complete?: () => void
901
873
  success?: (params: null) => void
902
874
  fail?: (params: {
903
875
  errorMsg: string
@@ -907,17 +879,17 @@ declare namespace ty {
907
879
  errorMsg: string
908
880
  }
909
881
  }) => void
882
+ complete?: () => void
910
883
  }): void
911
884
 
912
885
  /**
913
- * 针对具体的看板itemKey隐藏红点
914
- */
886
+ *@description 针对具体的看板itemKey隐藏红点
887
+ *@error {7: 'API Internal processing failed'}*/
915
888
  export function hiddenRedBot(params: {
916
889
  /** 生效页面, 默认当前页面 */
917
890
  effectPage?: EffectPage
918
891
  /** 看板item名称 */
919
892
  key: string
920
- complete?: () => void
921
893
  success?: (params: null) => void
922
894
  fail?: (params: {
923
895
  errorMsg: string
@@ -927,13 +899,13 @@ declare namespace ty {
927
899
  errorMsg: string
928
900
  }
929
901
  }) => void
902
+ complete?: () => void
930
903
  }): void
931
904
 
932
905
  /**
933
- * 关闭小程序页面加载框
934
- */
906
+ *@description 关闭小程序页面加载框, 如果页面配置中配置了manualHideLoading:true,需要手动调用此接口关闭加载框
907
+ *@error {7: 'API Internal processing failed'}*/
935
908
  export function hideRenderLoading(params?: {
936
- complete?: () => void
937
909
  success?: (params: null) => void
938
910
  fail?: (params: {
939
911
  errorMsg: string
@@ -943,15 +915,33 @@ declare namespace ty {
943
915
  errorMsg: string
944
916
  }
945
917
  }) => void
918
+ complete?: () => void
946
919
  }): void
947
920
 
948
921
  /**
949
- * 设置小程序页面背景图片,调用后小程序导航栏背景色将变为透明
950
- */
922
+ *@description 设置小程序页面背景图片,调用后小程序导航栏背景色将变为透明
923
+ *@error {7: 'API Internal processing failed'}*/
951
924
  export function setBackgroundImage(params: {
952
925
  /** 图片地址,支持网络图片和本地图片 */
953
926
  imageUrl: string
927
+ success?: (params: null) => void
928
+ fail?: (params: {
929
+ errorMsg: string
930
+ errorCode: string | number
931
+ innerError: {
932
+ errorCode: string | number
933
+ errorMsg: string
934
+ }
935
+ }) => void
954
936
  complete?: () => void
937
+ }): void
938
+
939
+ /**
940
+ *@description 设置小程序页面背景颜色
941
+ *@error {7: 'API Internal processing failed'}*/
942
+ export function setBackgroundColor(params: {
943
+ /** 当前页面背景颜色 */
944
+ color: string
955
945
  success?: (params: null) => void
956
946
  fail?: (params: {
957
947
  errorMsg: string
@@ -961,13 +951,12 @@ declare namespace ty {
961
951
  errorMsg: string
962
952
  }
963
953
  }) => void
954
+ complete?: () => void
964
955
  }): void
965
956
 
966
957
  /**
967
- * 在当前页面显示导航条加载动画
968
- */
958
+ *@description 在当前页面显示导航条加载动画*/
969
959
  export function showNavigationBarLoading(params?: {
970
- complete?: () => void
971
960
  success?: (params: null) => void
972
961
  fail?: (params: {
973
962
  errorMsg: string
@@ -977,15 +966,14 @@ declare namespace ty {
977
966
  errorMsg: string
978
967
  }
979
968
  }) => void
969
+ complete?: () => void
980
970
  }): void
981
971
 
982
972
  /**
983
- * 动态设置当前页面的标题
984
- */
973
+ *@description 动态设置当前页面的标题*/
985
974
  export function setNavigationBarTitle(params: {
986
975
  /** 页面标题 */
987
976
  title: string
988
- complete?: () => void
989
977
  success?: (params: null) => void
990
978
  fail?: (params: {
991
979
  errorMsg: string
@@ -995,11 +983,11 @@ declare namespace ty {
995
983
  errorMsg: string
996
984
  }
997
985
  }) => void
986
+ complete?: () => void
998
987
  }): void
999
988
 
1000
989
  /**
1001
- * 设置页面导航条颜色
1002
- */
990
+ *@description 设置页面导航条颜色*/
1003
991
  export function setNavigationBarColor(params: {
1004
992
  /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */
1005
993
  frontColor: string
@@ -1007,7 +995,6 @@ declare namespace ty {
1007
995
  backgroundColor: string
1008
996
  /** 动画效果 */
1009
997
  animation: NavigationBarColorAnimationInfo
1010
- complete?: () => void
1011
998
  success?: (params: null) => void
1012
999
  fail?: (params: {
1013
1000
  errorMsg: string
@@ -1017,13 +1004,12 @@ declare namespace ty {
1017
1004
  errorMsg: string
1018
1005
  }
1019
1006
  }) => void
1007
+ complete?: () => void
1020
1008
  }): void
1021
1009
 
1022
1010
  /**
1023
- * 在当前页面隐藏导航条加载动画
1024
- */
1011
+ *@description 在当前页面隐藏导航条加载动画*/
1025
1012
  export function hideNavigationBarLoading(params?: {
1026
- complete?: () => void
1027
1013
  success?: (params: null) => void
1028
1014
  fail?: (params: {
1029
1015
  errorMsg: string
@@ -1033,13 +1019,12 @@ declare namespace ty {
1033
1019
  errorMsg: string
1034
1020
  }
1035
1021
  }) => void
1022
+ complete?: () => void
1036
1023
  }): void
1037
1024
 
1038
1025
  /**
1039
- * 隐藏返回首页按钮
1040
- */
1026
+ *@description 隐藏返回首页按钮*/
1041
1027
  export function hideHomeButton(params?: {
1042
- complete?: () => void
1043
1028
  success?: (params: null) => void
1044
1029
  fail?: (params: {
1045
1030
  errorMsg: string
@@ -1049,13 +1034,14 @@ declare namespace ty {
1049
1034
  errorMsg: string
1050
1035
  }
1051
1036
  }) => void
1037
+ complete?: () => void
1052
1038
  }): void
1053
1039
 
1054
1040
  /**
1055
- * 路由到新页面
1056
- */
1041
+ *@description 路由到新页面
1042
+ *@error {40002: 'the page not be found'} | {40003: 'miniapp not exist'} | {40004: 'navigatorTo cannot open tab url'} | {40006: 'A maximum of ten pages can be opened'}*/
1057
1043
  export function navigateTo(params: {
1058
- /** 页面路径 */
1044
+ /** 页面路径, 参数需要做 url encode 处理 */
1059
1045
  url: string
1060
1046
  /** 打开方式,支持全屏full,半屏half;默认全屏full */
1061
1047
  type?: string
@@ -1072,7 +1058,6 @@ declare namespace ty {
1072
1058
  * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1073
1059
  */
1074
1060
  topMarginPercent?: number
1075
- complete?: () => void
1076
1061
  success?: (params: null) => void
1077
1062
  fail?: (params: {
1078
1063
  errorMsg: string
@@ -1082,15 +1067,15 @@ declare namespace ty {
1082
1067
  errorMsg: string
1083
1068
  }
1084
1069
  }) => void
1070
+ complete?: () => void
1085
1071
  }): void
1086
1072
 
1087
1073
  /**
1088
- * 关闭当前页面,返回上一页面或多级页面
1089
- */
1074
+ *@description 关闭当前页面,返回上一页面或多级页面
1075
+ *@error {40001: 'the last page cannot be navigator back'} | {40003: 'miniapp not exist'} | {40017: 'navigate back event already been intercept'}*/
1090
1076
  export function navigateBack(params?: {
1091
1077
  /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页 */
1092
1078
  delta?: number
1093
- complete?: () => void
1094
1079
  success?: (params: null) => void
1095
1080
  fail?: (params: {
1096
1081
  errorMsg: string
@@ -1100,30 +1085,15 @@ declare namespace ty {
1100
1085
  errorMsg: string
1101
1086
  }
1102
1087
  }) => void
1088
+ complete?: () => void
1103
1089
  }): void
1104
1090
 
1105
1091
  /**
1106
- * 关闭当前页面,跳转到应用内的某个页面
1107
- */
1092
+ *@description 关闭当前页面,跳转到应用内的某个页面
1093
+ *@error {40002: 'the page not be found'} | {40003: 'miniapp not exist'} | {40004: 'navigatorTo cannot open tab url'}*/
1108
1094
  export function redirectTo(params: {
1109
- /** 页面路径 */
1095
+ /** 页面路径, 参数需要做 url encode 处理 */
1110
1096
  url: string
1111
- /** 打开方式,支持全屏full,半屏half;默认全屏full */
1112
- type?: string
1113
- /**
1114
- * 非全屏页面距离屏幕顶部的距离,type 为 half 时有效
1115
- * 取值范围:【1-屏幕的高度】单位:px
1116
- * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1117
- * 因此 Android 的 topMargin 的最大值是屏幕高度减去状态栏的高度。
1118
- */
1119
- topMargin?: number
1120
- /**
1121
- * 非全屏页面距离屏幕顶部的百分比,type 为 half 时有效,优先级高于 topMargin
1122
- * 取值范围【1-99】单位:百分比
1123
- * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1124
- */
1125
- topMarginPercent?: number
1126
- complete?: () => void
1127
1097
  success?: (params: null) => void
1128
1098
  fail?: (params: {
1129
1099
  errorMsg: string
@@ -1133,30 +1103,15 @@ declare namespace ty {
1133
1103
  errorMsg: string
1134
1104
  }
1135
1105
  }) => void
1106
+ complete?: () => void
1136
1107
  }): void
1137
1108
 
1138
1109
  /**
1139
- * 关闭所有页面,打开到应用内的某个页面
1140
- */
1110
+ *@description 关闭所有页面,打开到应用内的某个页面
1111
+ *@error {40002: 'the page not be found'} | {40003: 'miniapp not exist'}*/
1141
1112
  export function reLaunch(params: {
1142
- /** 页面路径 */
1113
+ /** 页面路径, 参数需要做 url encode 处理 */
1143
1114
  url: string
1144
- /** 打开方式,支持全屏full,半屏half;默认全屏full */
1145
- type?: string
1146
- /**
1147
- * 非全屏页面距离屏幕顶部的距离,type 为 half 时有效
1148
- * 取值范围:【1-屏幕的高度】单位:px
1149
- * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1150
- * 因此 Android 的 topMargin 的最大值是屏幕高度减去状态栏的高度。
1151
- */
1152
- topMargin?: number
1153
- /**
1154
- * 非全屏页面距离屏幕顶部的百分比,type 为 half 时有效,优先级高于 topMargin
1155
- * 取值范围【1-99】单位:百分比
1156
- * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1157
- */
1158
- topMarginPercent?: number
1159
- complete?: () => void
1160
1115
  success?: (params: null) => void
1161
1116
  fail?: (params: {
1162
1117
  errorMsg: string
@@ -1166,30 +1121,15 @@ declare namespace ty {
1166
1121
  errorMsg: string
1167
1122
  }
1168
1123
  }) => void
1124
+ complete?: () => void
1169
1125
  }): void
1170
1126
 
1171
1127
  /**
1172
- * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
1173
- */
1128
+ *@description 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
1129
+ *@error {40002: 'the page not be found'} | {40003: 'miniapp not exist'} | {40007: 'cannot find page url from tab config'} | {40008: 'no tab config'} | {40011: 'miniapp can not support on tab'}*/
1174
1130
  export function switchTab(params: {
1175
- /** 页面路径 */
1131
+ /** 页面路径, 不支持参数 */
1176
1132
  url: string
1177
- /** 打开方式,支持全屏full,半屏half;默认全屏full */
1178
- type?: string
1179
- /**
1180
- * 非全屏页面距离屏幕顶部的距离,type 为 half 时有效
1181
- * 取值范围:【1-屏幕的高度】单位:px
1182
- * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1183
- * 因此 Android 的 topMargin 的最大值是屏幕高度减去状态栏的高度。
1184
- */
1185
- topMargin?: number
1186
- /**
1187
- * 非全屏页面距离屏幕顶部的百分比,type 为 half 时有效,优先级高于 topMargin
1188
- * 取值范围【1-99】单位:百分比
1189
- * 注意:Android 显示区域不包括状态栏,iOS显示区域包括状态栏。
1190
- */
1191
- topMarginPercent?: number
1192
- complete?: () => void
1193
1133
  success?: (params: null) => void
1194
1134
  fail?: (params: {
1195
1135
  errorMsg: string
@@ -1199,17 +1139,15 @@ declare namespace ty {
1199
1139
  errorMsg: string
1200
1140
  }
1201
1141
  }) => void
1142
+ complete?: () => void
1202
1143
  }): void
1203
1144
 
1204
1145
  /**
1205
- * 判断自定义API是否可用
1206
- */
1146
+ *@description 判断自定义API是否可用
1147
+ *@error {5: 'The necessary parameters are missing'} | {40020: 'ext api fail'}*/
1207
1148
  export function extApiCanIUse(params: {
1208
1149
  /** api名称 */
1209
1150
  api: string
1210
- /** api参数 */
1211
- params?: Record<string, any>
1212
- complete?: () => void
1213
1151
  success?: (params: {
1214
1152
  /** 当前版本是否可用 */
1215
1153
  result: boolean
@@ -1222,25 +1160,25 @@ declare namespace ty {
1222
1160
  errorMsg: string
1223
1161
  }
1224
1162
  }) => void
1163
+ complete?: () => void
1225
1164
  }): void
1226
1165
 
1227
1166
  /**
1228
- * 判断自定义API是否可用
1229
- */
1230
- export function extApiCanIUseSync(extApiBean?: ExtApiBean): {
1167
+ *@description 判断自定义API是否可用
1168
+ *@error {5: 'The necessary parameters are missing'} | {40020: 'ext api fail'}*/
1169
+ export function extApiCanIUseSync(caniuseBean?: CanIUseBean): {
1231
1170
  /** 当前版本是否可用 */
1232
1171
  result: boolean
1233
1172
  }
1234
1173
 
1235
1174
  /**
1236
- * 调用自定义API
1237
- */
1175
+ *@description 调用自定义API
1176
+ *@error {40019: 'ext api not found'} | {40020: 'ext api fail'}*/
1238
1177
  export function extApiInvoke(params: {
1239
1178
  /** api名称 */
1240
1179
  api: string
1241
1180
  /** api参数 */
1242
- params?: Record<string, any>
1243
- complete?: () => void
1181
+ params?: any
1244
1182
  success?: (params: {
1245
1183
  /** extApi返回数据 */
1246
1184
  data?: {}
@@ -1253,21 +1191,21 @@ declare namespace ty {
1253
1191
  errorMsg: string
1254
1192
  }
1255
1193
  }) => void
1194
+ complete?: () => void
1256
1195
  }): void
1257
1196
 
1258
1197
  /**
1259
- * 调用自定义API
1260
- */
1198
+ *@description 调用自定义API
1199
+ *@error {40019: 'ext api not found'} | {40020: 'ext api fail'}*/
1261
1200
  export function extApiInvokeSync(extApiBean?: ExtApiBean): {
1262
1201
  /** extApi返回数据 */
1263
1202
  data?: {}
1264
1203
  }
1265
1204
 
1266
1205
  /**
1267
- * 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
1268
- */
1206
+ *@description 开始下拉刷新。调用后触发当前页面下拉刷新动画,效果与用户手动下拉刷新一致。
1207
+ *@error {7: 'API Internal processing failed'}*/
1269
1208
  export function startPullDownRefresh(params?: {
1270
- complete?: () => void
1271
1209
  success?: (params: null) => void
1272
1210
  fail?: (params: {
1273
1211
  errorMsg: string
@@ -1277,13 +1215,13 @@ declare namespace ty {
1277
1215
  errorMsg: string
1278
1216
  }
1279
1217
  }) => void
1218
+ complete?: () => void
1280
1219
  }): void
1281
1220
 
1282
1221
  /**
1283
- * 停止当前页面下拉刷新。
1284
- */
1222
+ *@description 停止当前页面下拉刷新。
1223
+ *@error {7: 'API Internal processing failed'}*/
1285
1224
  export function stopPullDownRefresh(params?: {
1286
- complete?: () => void
1287
1225
  success?: (params: null) => void
1288
1226
  fail?: (params: {
1289
1227
  errorMsg: string
@@ -1293,15 +1231,14 @@ declare namespace ty {
1293
1231
  errorMsg: string
1294
1232
  }
1295
1233
  }) => void
1234
+ complete?: () => void
1296
1235
  }): void
1297
1236
 
1298
1237
  /**
1299
- * 移除当前widget视图, 仅在widget内部调用且不支持Dialog形式
1300
- */
1238
+ *@description 移除当前widget视图, 仅在widget内部调用且不支持Dialog形式*/
1301
1239
  export function widgetRemove(params?: {
1302
1240
  /** 移除模式 */
1303
1241
  mode?: WidgetMode
1304
- complete?: () => void
1305
1242
  success?: (params: null) => void
1306
1243
  fail?: (params: {
1307
1244
  errorMsg: string
@@ -1311,62 +1248,68 @@ declare namespace ty {
1311
1248
  errorMsg: string
1312
1249
  }
1313
1250
  }) => void
1251
+ complete?: () => void
1314
1252
  }): void
1315
1253
 
1316
1254
  /**
1317
- * 原生上报的事件
1318
- */
1319
- export function onNativeEvent(
1320
- listener: (params: NativeUploadData) => void
1321
- ): void
1255
+ *@description 原生上报的事件*/
1256
+ export function onNativeEvent(listener: (params: NativeUploadData) => void): void
1322
1257
 
1323
1258
  /**
1324
- * 取消监听:原生上报的事件
1325
- */
1326
- export function offNativeEvent(
1327
- listener: (params: NativeUploadData) => void
1328
- ): void
1259
+ *@description 移除监听:原生上报的事件*/
1260
+ export function offNativeEvent(listener: (params: NativeUploadData) => void): void
1329
1261
 
1330
1262
  export enum HighwayMethod {
1331
1263
  /** HTTP 请求 OPTIONS */
1332
- OPTIONS = "OPTIONS",
1264
+ OPTIONS = 'OPTIONS',
1333
1265
 
1334
1266
  /** HTTP 请求 GET */
1335
- GET = "GET",
1267
+ GET = 'GET',
1336
1268
 
1337
1269
  /** HTTP 请求 HEAD */
1338
- HEAD = "HEAD",
1270
+ HEAD = 'HEAD',
1339
1271
 
1340
1272
  /** HTTP 请求 POST */
1341
- POST = "POST",
1273
+ POST = 'POST',
1342
1274
 
1343
1275
  /** HTTP 请求 PUT */
1344
- PUT = "PUT",
1276
+ PUT = 'PUT',
1345
1277
 
1346
1278
  /** HTTP 请求 DELETE */
1347
- DELETE = "DELETE",
1279
+ DELETE = 'DELETE',
1348
1280
 
1349
1281
  /** HTTP 请求 TRACE */
1350
- TRACE = "TRACE",
1282
+ TRACE = 'TRACE',
1351
1283
 
1352
1284
  /** HTTP 请求 TRACE */
1353
- CONNECT = "CONNECT",
1285
+ CONNECT = 'CONNECT',
1286
+ }
1287
+
1288
+ export enum MiniAppScene {
1289
+ /** 默认值 */
1290
+ DEFAULT = 1000,
1291
+
1292
+ /** 通过最近使用小程序列表进入 */
1293
+ RECENTLY_USED = 1001,
1294
+
1295
+ /** 通过URL映射进入 */
1296
+ URL_MAPPING = 1002,
1354
1297
  }
1355
1298
 
1356
1299
  export type ReferrerInfo = {
1357
- /** 来源小程序、公众号或 App 的 appId */
1300
+ /** 来源小程序的 appId */
1358
1301
  appId: string
1359
1302
  /** 来源小程序传过来的数据,特定scene支持 */
1360
- extraData: Record<string, any>
1303
+ extraData: any
1361
1304
  }
1362
1305
 
1363
1306
  export type BoardBean = {
1364
- /** 看板的标题 */
1307
+ /** 看板页标题 */
1365
1308
  title: string
1366
1309
  }
1367
1310
 
1368
1311
  export type BoardIconBean = {
1369
- /** 看板的icon */
1312
+ /** 看板页icon */
1370
1313
  icon: string
1371
1314
  }
1372
1315
 
@@ -1395,10 +1338,10 @@ declare namespace ty {
1395
1338
 
1396
1339
  export enum EffectPage {
1397
1340
  /** 当前页面 */
1398
- current = "current",
1341
+ current = 'current',
1399
1342
 
1400
1343
  /** 所有页面 */
1401
- all = "all",
1344
+ all = 'all',
1402
1345
  }
1403
1346
 
1404
1347
  export type BoardItemBean = {
@@ -1417,27 +1360,32 @@ declare namespace ty {
1417
1360
  duration?: number
1418
1361
  /**
1419
1362
  * 动画变化方式
1420
- * 'linear' 动画从头到尾的速度是相同的
1421
- * 'easeIn' 动画以低速开始
1422
- * 'easeOut' 动画以低速结束
1423
- * 'easeInOut' 动画以低速开始和结束
1363
+ * 'linear' 动画从头到尾的速度是相同的
1364
+ * 'easeIn' 动画以低速开始
1365
+ * 'easeOut' 动画以低速结束
1366
+ * 'easeInOut' 动画以低速开始和结束
1424
1367
  */
1425
1368
  timingFunc?: string
1426
1369
  }
1427
1370
 
1371
+ export type CanIUseBean = {
1372
+ /** api名称 */
1373
+ api: string
1374
+ }
1375
+
1428
1376
  export type ExtApiBean = {
1429
1377
  /** api名称 */
1430
1378
  api: string
1431
1379
  /** api参数 */
1432
- params?: Record<string, any>
1380
+ params?: any
1433
1381
  }
1434
1382
 
1435
1383
  export enum WidgetMode {
1436
1384
  /** 单次移除 */
1437
- ONCE = "ONCE",
1385
+ ONCE = 'ONCE',
1438
1386
 
1439
1387
  /** 永久移除 */
1440
- FOREVER = "FOREVER",
1388
+ FOREVER = 'FOREVER',
1441
1389
  }
1442
1390
 
1443
1391
  export type NativeUploadData = {
@@ -1448,11 +1396,9 @@ declare namespace ty {
1448
1396
  /** 小程序页面id */
1449
1397
  pageId: string
1450
1398
  /** 数据等 */
1451
- data: Record<string, Object>
1399
+ data: any
1452
1400
  }
1453
1401
 
1454
- export type Object = {}
1455
-
1456
1402
  export type NativeDisabledParam = {
1457
1403
  /** 禁用异层渲染手势分发 */
1458
1404
  nativeDisabled: boolean
@@ -1470,17 +1416,19 @@ declare namespace ty {
1470
1416
  /** 小程序页面id */
1471
1417
  pageId: string
1472
1418
  /** 参数等 */
1473
- params: Record<string, string>
1419
+ params: any
1474
1420
  }
1475
1421
 
1422
+ export type Object = {}
1423
+
1476
1424
  export type PermissionConfig = {
1477
1425
  /** 权限相关配置信息 */
1478
- result: Record<string, any>
1426
+ result: any
1479
1427
  }
1480
1428
 
1481
1429
  export type AuthSetting = {
1482
1430
  /** 用户授权设置信息 */
1483
- scope: Record<string, boolean>
1431
+ scope: any
1484
1432
  }
1485
1433
 
1486
1434
  export type DebugModeSetting = {
@@ -1488,7 +1436,7 @@ declare namespace ty {
1488
1436
  isEnable: boolean
1489
1437
  }
1490
1438
 
1491
- export type RedDotParams = {
1439
+ export type TabBarIndexBean = {
1492
1440
  /** tabBar 的哪一项,从左边算起 */
1493
1441
  index: number
1494
1442
  }
@@ -1531,31 +1479,30 @@ declare namespace ty {
1531
1479
  /** api 名称 */
1532
1480
  api: string
1533
1481
  /** data 请求入参 */
1534
- data?: Record<string, any>
1482
+ data?: any
1535
1483
  /** method 请求方法 */
1536
1484
  method?: HighwayMethod
1537
1485
  }
1538
1486
 
1539
1487
  export type HighwayRequestResponse = {
1540
- /**
1541
- * 请求结果
1542
- * thing_data_ 出参结构体, JSON序列化
1543
- */
1488
+ /** 接口返回数据的序列化对象,序列化失败时为null */
1544
1489
  thing_json_?: {}
1545
- /** 元数据 */
1490
+ /** 接口返回的原始数据 */
1546
1491
  data: string
1547
1492
  }
1548
1493
 
1549
1494
  export type BackMiniProgramBean = {
1550
1495
  /** 需要返回给上一个小程序的数据,上一个小程序可在 App.onShow 中获取到这份数据 */
1551
- extraData?: Record<string, any>
1496
+ extraData?: any
1552
1497
  }
1553
1498
 
1554
1499
  export type MiniAppOptions = {
1555
1500
  /** 启动小程序的路径 (代码包路径) */
1556
1501
  path: string
1502
+ /** 启动小程序的场景值 */
1503
+ scene?: MiniAppScene
1557
1504
  /** 启动小程序的 query 参数 */
1558
- query: Record<string, any>
1505
+ query: any
1559
1506
  /** 分享转发 */
1560
1507
  referrerInfo: ReferrerInfo
1561
1508
  /** API 类别: default 默认类别; embedded 内嵌,通过打开半屏小程序能力打开的小程序 */
@@ -1633,6 +1580,11 @@ declare namespace ty {
1633
1580
  imageUrl: string
1634
1581
  }
1635
1582
 
1583
+ export type BackgroundColorBean = {
1584
+ /** 当前页面背景颜色 */
1585
+ color: string
1586
+ }
1587
+
1636
1588
  export type CreateReq = {
1637
1589
  /** managerId: 通知管理器id */
1638
1590
  managerId: string
@@ -1660,7 +1612,7 @@ declare namespace ty {
1660
1612
  }
1661
1613
 
1662
1614
  export type RouteBean = {
1663
- /** 页面路径 */
1615
+ /** 页面路径, 参数需要做 url encode 处理 */
1664
1616
  url: string
1665
1617
  /** 打开方式,支持全屏full,半屏half;默认全屏full */
1666
1618
  type?: string
@@ -1684,6 +1636,21 @@ declare namespace ty {
1684
1636
  delta?: number
1685
1637
  }
1686
1638
 
1639
+ export type RedirectBean = {
1640
+ /** 页面路径, 参数需要做 url encode 处理 */
1641
+ url: string
1642
+ }
1643
+
1644
+ export type ReLaunchBean = {
1645
+ /** 页面路径, 参数需要做 url encode 处理 */
1646
+ url: string
1647
+ }
1648
+
1649
+ export type SwitchTabBean = {
1650
+ /** 页面路径, 不支持参数 */
1651
+ url: string
1652
+ }
1653
+
1687
1654
  export type SuccessResult = {
1688
1655
  /** 当前版本是否可用 */
1689
1656
  result: boolean
@@ -1700,14 +1667,13 @@ declare namespace ty {
1700
1667
  }
1701
1668
 
1702
1669
  /**
1703
- * 原生主动发送通知
1704
- */
1705
- interface CreateNativeEventManagerTask {
1670
+ *@description 原生主动发送通知*/
1671
+ interface NativeEventManager {
1706
1672
  /**
1707
- * 停止监听通知
1708
- */
1673
+ *@description 停止监听通知
1674
+ *@deprecated 方法已停止维护,请谨慎使用,推荐使用offListener代替。
1675
+ *@error {5: 'The necessary parameters are missing'}*/
1709
1676
  offerListener(params: {
1710
- complete?: () => void
1711
1677
  success?: (params: null) => void
1712
1678
  fail?: (params: {
1713
1679
  errorMsg: string
@@ -1717,24 +1683,34 @@ declare namespace ty {
1717
1683
  errorMsg: string
1718
1684
  }
1719
1685
  }) => void
1686
+ complete?: () => void
1720
1687
  }): void
1721
1688
 
1722
1689
  /**
1723
- * 开始监听通知
1724
- */
1690
+ *@description 开始监听通知
1691
+ *@error {5: 'The necessary parameters are missing'}*/
1725
1692
  onListener(
1726
1693
  listener: (params: {
1727
- /** managerId */
1728
- managerId: string
1694
+ /** data: 通知内容 */
1695
+ data: {}
1696
+ }) => void
1697
+ ): void
1698
+
1699
+ /**
1700
+ *@description 停止监听通知
1701
+ *@error {5: 'The necessary parameters are missing'}*/
1702
+ offListener(
1703
+ listener: (params: {
1729
1704
  /** data: 通知内容 */
1730
1705
  data: {}
1731
1706
  }) => void
1732
1707
  ): void
1733
1708
  }
1709
+ /**
1710
+ *@description 创建原生通知管理器*/
1734
1711
  export function createNativeEventManager(params: {
1735
1712
  /** name: 通知名称 */
1736
1713
  name: string
1737
- complete?: () => void
1738
1714
  success?: (params: null) => void
1739
1715
  fail?: (params: {
1740
1716
  errorMsg: string
@@ -1744,5 +1720,6 @@ declare namespace ty {
1744
1720
  errorMsg: string
1745
1721
  }
1746
1722
  }) => void
1747
- }): CreateNativeEventManagerTask
1723
+ complete?: () => void
1724
+ }): NativeEventManager
1748
1725
  }