@dcloudio/uni-app-x 0.7.38 → 0.7.39

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 (104) hide show
  1. package/package.json +1 -1
  2. package/types/UniPage.d.ts +4 -0
  3. package/types/native/CanvasRenderingContext2D.d.ts +1 -1
  4. package/types/native/IUniElement.d.ts +105 -44
  5. package/types/native/global.d.ts +14 -8
  6. package/types/page.d.ts +45 -3
  7. package/types/uni/env/index.d.ts +81 -81
  8. package/types/uni/uni-map-tencent-map.d.ts +7 -7
  9. package/types/uni/uts-plugin-api/global.d.ts +0 -2
  10. package/types/uni/uts-plugin-api/index.d.ts +0 -2
  11. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/interface.d.ts +1 -1
  12. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/interface.d.ts +73 -73
  13. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/interface.d.ts +331 -331
  14. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/interface.d.ts +73 -73
  15. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/interface.d.ts +628 -628
  16. package/types/uni/uts-plugin-api/lib/uni-chooseLocation/utssdk/interface.d.ts +414 -153
  17. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/interface.d.ts +2 -2
  18. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +1218 -1987
  19. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/interface.d.ts +1 -1
  20. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/interface.d.ts +6 -6
  21. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/interface.d.ts +156 -81
  22. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/interface.d.ts +315 -315
  23. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/interface.d.ts +5 -5
  24. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +2530 -2126
  25. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +490 -490
  26. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +2138 -2005
  27. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/global.d.ts +4 -0
  28. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/index.d.ts +2 -0
  29. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +663 -113
  30. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +20 -20
  31. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/interface.d.ts +3 -3
  32. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/interface.d.ts +217 -217
  33. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/interface.d.ts +2 -2
  34. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/interface.d.ts +809 -809
  35. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/interface.d.ts +274 -274
  36. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/interface.d.ts +1 -1
  37. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +969 -969
  38. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +106 -106
  39. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/interface.d.ts +23 -23
  40. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/interface.d.ts +2 -2
  41. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/interface.d.ts +1 -1
  42. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +41 -41
  43. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/interface.d.ts +88 -88
  44. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +1680 -1528
  45. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/interface.d.ts +16 -16
  46. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +3620 -3618
  47. package/types/uni/uts-plugin-api/lib/uni-oauth/utssdk/interface.d.ts +12 -12
  48. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/interface.d.ts +1 -1
  49. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/interface.d.ts +3 -3
  50. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/interface.d.ts +621 -621
  51. package/types/uni/uts-plugin-api/lib/uni-privacy/utssdk/interface.d.ts +22 -22
  52. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +2602 -2391
  53. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/interface.d.ts +2 -2
  54. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/interface.d.ts +26 -26
  55. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +77 -77
  56. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/interface.d.ts +1 -1
  57. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/interface.d.ts +857 -857
  58. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/interface.d.ts +17 -17
  59. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/global.d.ts +8 -0
  60. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/index.d.ts +4 -0
  61. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/interface.d.ts +1057 -516
  62. package/types/uni/uts-plugin-api/lib/uni-virtualPayment/utssdk/interface.d.ts +1660 -1660
  63. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +1746 -1746
  64. package/types/uni/uts-plugin-biz/global.d.ts +1 -0
  65. package/types/uni/uts-plugin-biz/index.d.ts +1 -0
  66. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +84 -0
  67. package/types/uni/{uts-plugin-api → uts-plugin-biz}/lib/uni-crash/utssdk/interface.d.ts +46 -46
  68. package/types/uni/uts-plugin-biz/lib/uni-map-tencent/utssdk/interface.d.ts +72 -20
  69. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/interface.d.ts +126 -0
  70. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/global.d.ts +2 -0
  71. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/index.d.ts +1 -0
  72. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +63 -12
  73. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +308 -308
  74. package/types/uni/uts-plugin-extend/global.d.ts +1 -0
  75. package/types/uni/uts-plugin-extend/lib/uni-__f__/utssdk/global.d.ts +7 -0
  76. package/types/uni/uts-plugin-extend/lib/uni-__f__/utssdk/index.d.ts +0 -0
  77. package/types/uni/uts-plugin-extend/lib/uni-__f__/utssdk/interface.d.ts +3 -0
  78. package/types/uni/uts-plugin-extend/lib/uni-accelerometer/utssdk/interface.d.ts +4 -4
  79. package/types/uni/uts-plugin-extend/lib/uni-canvas/utssdk/interface.d.ts +5 -5
  80. package/types/uni/uts-plugin-extend/lib/uni-compass/utssdk/interface.d.ts +1 -1
  81. package/types/uni/uts-plugin-extend/lib/uni-createMediaQueryObserver/utssdk/interface.d.ts +77 -77
  82. package/types/uni/uts-plugin-extend/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +11 -11
  83. package/types/uni/uts-plugin-extend/lib/uni-locale/utssdk/interface.d.ts +3 -3
  84. package/types/uni/uts-plugin-extend/lib/uni-localeChange/utssdk/interface.d.ts +6 -6
  85. package/types/uni/uts-plugin-extend/lib/uni-memory/utssdk/interface.d.ts +2 -2
  86. package/types/uni/uts-plugin-extend/lib/uni-openLocation/utssdk/interface.d.ts +1 -1
  87. package/types/uni-cloud/interface.d.ts +13 -13
  88. package/types/uni/uts-plugin-api/lib/uni-actionSheet/utssdk/global.d.ts +0 -24
  89. package/types/uni/uts-plugin-api/lib/uni-actionSheet/utssdk/index.d.ts +0 -11
  90. package/types/uni/uts-plugin-api/lib/uni-actionSheet/utssdk/interface.d.ts +0 -217
  91. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/global.d.ts +0 -21
  92. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/index.d.ts +0 -9
  93. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/interface.d.ts +0 -151
  94. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/global.d.ts +0 -11
  95. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/index.d.ts +0 -4
  96. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +0 -224
  97. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/global.d.ts +0 -53
  98. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/index.d.ts +0 -25
  99. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/interface.d.ts +0 -487
  100. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/global.d.ts +0 -9
  101. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/index.d.ts +0 -1
  102. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/interface.d.ts +0 -165
  103. /package/types/uni/{uts-plugin-api → uts-plugin-biz}/lib/uni-crash/utssdk/global.d.ts +0 -0
  104. /package/types/uni/{uts-plugin-api → uts-plugin-biz}/lib/uni-crash/utssdk/index.d.ts +0 -0
@@ -1,516 +1,1057 @@
1
- export interface Uni {
2
- /**
3
- * 开启监听系统主题变化
4
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onosthemechange
5
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onosthemechange
6
- * @uniPlatform
7
- * {
8
- * "app": {
9
- * "android": {
10
- * "osVer": "5.0",
11
- * "uniVer": "x",
12
- * "unixVer": "4.18"
13
- * },
14
- * "ios": {
15
- * "osVer": "12.0",
16
- * "uniVer": "x",
17
- * "unixVer": "4.18"
18
- * },
19
- * "harmony": {
20
- * "osVer": "x",
21
- * "uniVer": "x",
22
- * "unixVer": "x"
23
- * }
24
- * },
25
- * "web": {
26
- * "uniVer": "x",
27
- * "unixVer": "x"
28
- * }
29
- * }
30
- * @example
31
- ```typescript
32
- const id = uni.onOsThemeChange((res) => {
33
- console.log(res.osTheme)
34
- })
35
- ```
36
- */
37
- onOsThemeChange(callback : OnOsThemeChangeCallback): number
38
-
39
- /**
40
- * 取消监听系统主题变化
41
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offosthemechange
42
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offosthemechange
43
- * @uniPlatform
44
- * {
45
- * "app": {
46
- * "android": {
47
- * "osVer": "5.0",
48
- * "uniVer": "x",
49
- * "unixVer": "4.18"
50
- * },
51
- * "ios": {
52
- * "osVer": "12.0",
53
- * "uniVer": "x",
54
- * "unixVer": "4.18"
55
- * },
56
- * "harmony": {
57
- * "osVer": "x",
58
- * "uniVer": "x",
59
- * "unixVer": "x"
60
- * }
61
- * },
62
- * "web": {
63
- * "uniVer": "x",
64
- * "unixVer": "x"
65
- * }
66
- * }
67
- * @example
68
- ```typescript
69
- uni.offOsThemeChange(id)
70
- ```
71
- */
72
- offOsThemeChange(id : number): void
73
-
74
- /**
75
- * 设置应用主题
76
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#setapptheme
77
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#setapptheme
78
- * @uniPlatform
79
- * {
80
- * "app": {
81
- * "android": {
82
- * "osVer": "5.0",
83
- * "uniVer": "x",
84
- * "unixVer": "4.18"
85
- * },
86
- * "ios": {
87
- * "osVer": "12.0",
88
- * "uniVer": "x",
89
- * "unixVer": "4.18"
90
- * }
91
- * },
92
- * "web": {
93
- * "uniVer": "x",
94
- * "unixVer": "x"
95
- * }
96
- * }
97
- * @example
98
- ```typescript
99
- uni.setAppTheme({
100
- theme: 'dark',
101
- success: (res) => {
102
- console.log('success')
103
- },
104
- fail: (err) => {
105
- console.log(err)
106
- },
107
- complete: (res) => {
108
- console.log('complete')
109
- }
110
- })
111
- ```
112
- */
113
- setAppTheme(options : SetAppThemeOptions): void
114
-
115
- /**
116
- * 开启监听应用主题变化
117
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onappthemechange
118
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onappthemechange
119
- * @uniPlatform
120
- * {
121
- * "app": {
122
- * "android": {
123
- * "osVer": "5.0",
124
- * "uniVer": "x",
125
- * "unixVer": "4.18"
126
- * },
127
- * "ios": {
128
- * "osVer": "12.0",
129
- * "uniVer": "x",
130
- * "unixVer": "4.18"
131
- * }
132
- * },
133
- * "web": {
134
- * "uniVer": "x",
135
- * "unixVer": "x"
136
- * }
137
- * }
138
- * @example
139
- ```typescript
140
- const id = uni.onAppThemeChange((res) => {
141
- console.log(res.appTheme)
142
- })
143
- ```
144
- */
145
- onAppThemeChange(callback : OnAppThemeChangeCallback): number
146
-
147
- /**
148
- * 取消监听应用主题变化
149
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offappthemechange
150
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offappthemechange
151
- * @uniPlatform
152
- * {
153
- * "app": {
154
- * "android": {
155
- * "osVer": "5.0",
156
- * "uniVer": "x",
157
- * "unixVer": "4.18"
158
- * },
159
- * "ios": {
160
- * "osVer": "12.0",
161
- * "uniVer": "x",
162
- * "unixVer": "4.18"
163
- * }
164
- * },
165
- * "web": {
166
- * "uniVer": "x",
167
- * "unixVer": "x"
168
- * }
169
- * }
170
- * @example
171
- ```typescript
172
- uni.offAppThemeChange(id)
173
- ```
174
- */
175
- offAppThemeChange(id : number): void
176
- }
177
-
178
- /**
179
- * @uniPlatform
180
- * {
181
- * "app": {
182
- * "android": {
183
- * "osVer": "5.0",
184
- * "uniVer": "x",
185
- * "unixVer": "4.18"
186
- * },
187
- * "ios": {
188
- * "osVer": "12.0",
189
- * "uniVer": "x",
190
- * "unixVer": "4.18"
191
- * },
192
- * "harmony": {
193
- * "osVer": "x",
194
- * "uniVer": "x",
195
- * "unixVer": "x"
196
- * }
197
- * },
198
- * "web": {
199
- * "uniVer": "x",
200
- * "unixVer": "x"
201
- * }
202
- * }
203
- */
204
- export type OsThemeChangeResult = {
205
- /**
206
- * 系统主题
207
- * @uniPlatform
208
- * {
209
- * "app": {
210
- * "android": {
211
- * "osVer": "5.0",
212
- * "uniVer": "x",
213
- * "unixVer": "4.18"
214
- * },
215
- * "ios": {
216
- * "osVer": "12.0",
217
- * "uniVer": "x",
218
- * "unixVer": "4.18"
219
- * },
220
- * "harmony": {
221
- * "osVer": "x",
222
- * "uniVer": "x",
223
- * "unixVer": "x"
224
- * }
225
- * },
226
- * "web": {
227
- * "uniVer": "x",
228
- * "unixVer": "x"
229
- * }
230
- * }
231
- */
232
- osTheme : string
233
- }
234
-
235
- /**
236
- * @uniPlatform
237
- * {
238
- * "app": {
239
- * "android": {
240
- * "osVer": "5.0",
241
- * "uniVer": "x",
242
- * "unixVer": "4.18"
243
- * },
244
- * "ios": {
245
- * "osVer": "12.0",
246
- * "uniVer": "x",
247
- * "unixVer": "4.18"
248
- * },
249
- * "harmony": {
250
- * "osVer": "x",
251
- * "uniVer": "x",
252
- * "unixVer": "x"
253
- * }
254
- * },
255
- * "web": {
256
- * "uniVer": "x",
257
- * "unixVer": "x"
258
- * }
259
- * }
260
- */
261
- export type AppThemeChangeResult = {
262
- /**
263
- * 应用主题
264
- * @uniPlatform
265
- * {
266
- * "app": {
267
- * "android": {
268
- * "osVer": "5.0",
269
- * "uniVer": "x",
270
- * "unixVer": "4.18"
271
- * },
272
- * "ios": {
273
- * "osVer": "12.0",
274
- * "uniVer": "x",
275
- * "unixVer": "4.18"
276
- * },
277
- * "harmony": {
278
- * "osVer": "x",
279
- * "uniVer": "x",
280
- * "unixVer": "x"
281
- * }
282
- * },
283
- * "web": {
284
- * "uniVer": "x",
285
- * "unixVer": "x"
286
- * }
287
- * }
288
- */
289
- appTheme : string
290
- }
291
-
292
- /*
293
- * 系统主题相关类型定义
294
- */
295
- export type OnOsThemeChangeCallback = (res : OsThemeChangeResult) => void
296
- export type OnOsThemeChange = (callback : OnOsThemeChangeCallback) => number
297
- export type OffOsThemeChange = (id : number) => void
298
-
299
- /*
300
- * 应用主题相关类型定义
301
- */
302
- export type SetAppTheme = (options : SetAppThemeOptions) => void
303
- export type OnAppThemeChangeCallback = (res : AppThemeChangeResult) => void
304
- export type OnAppThemeChange = (callback : OnAppThemeChangeCallback) => number
305
- export type OffAppThemeChange = (id : number) => void
306
- export type SetAppThemeSuccessResult = {
307
- theme : string
308
- }
309
- export type SetAppThemeSuccessCallback = (result : SetAppThemeSuccessResult) => void;
310
- export type SetAppThemeFailCallback = (result : AppThemeFail) => void;
311
- export type SetAppThemeCompleteCallback = (result : any) => void;
312
-
313
- /**
314
- * @uniPlatform
315
- * {
316
- * "app": {
317
- * "android": {
318
- * "osVer": "5.0",
319
- * "uniVer": "x",
320
- * "unixVer": "4.18"
321
- * },
322
- * "ios": {
323
- * "osVer": "12.0",
324
- * "uniVer": "x",
325
- * "unixVer": "4.18"
326
- * },
327
- * "harmony": {
328
- * "osVer": "x",
329
- * "uniVer": "x",
330
- * "unixVer": "x"
331
- * }
332
- * },
333
- * "web": {
334
- * "uniVer": "x",
335
- * "unixVer": "x"
336
- * }
337
- * }
338
- */
339
- export type SetAppThemeOptions = {
340
- /**
341
- * 主题
342
- * @uniPlatform
343
- * {
344
- * "app": {
345
- * "android": {
346
- * "osVer": "5.0",
347
- * "uniVer": "x",
348
- * "unixVer": "4.18"
349
- * },
350
- * "ios": {
351
- * "osVer": "12.0",
352
- * "uniVer": "x",
353
- * "unixVer": "4.18"
354
- * },
355
- * "harmony": {
356
- * "osVer": "x",
357
- * "uniVer": "x",
358
- * "unixVer": "x"
359
- * }
360
- * },
361
- * "web": {
362
- * "uniVer": "x",
363
- * "unixVer": "x"
364
- * }
365
- * }
366
- */
367
- theme : 'light' | 'dark' | 'auto'
368
- /**
369
- * 接口调用成功的回调函数
370
- * @defaultValue null
371
- * @uniPlatform
372
- * {
373
- * "app": {
374
- * "android": {
375
- * "osVer": "5.0",
376
- * "uniVer": "x",
377
- * "unixVer": "4.18"
378
- * },
379
- * "ios": {
380
- * "osVer": "12.0",
381
- * "uniVer": "x",
382
- * "unixVer": "4.18"
383
- * },
384
- * "harmony": {
385
- * "osVer": "x",
386
- * "uniVer": "x",
387
- * "unixVer": "x"
388
- * }
389
- * },
390
- * "web": {
391
- * "uniVer": "x",
392
- * "unixVer": "x"
393
- * }
394
- * }
395
- */
396
- success? : SetAppThemeSuccessCallback
397
- /**
398
- * 接口调用失败的回调函数
399
- * @defaultValue null
400
- * @uniPlatform
401
- * {
402
- * "app": {
403
- * "android": {
404
- * "osVer": "5.0",
405
- * "uniVer": "x",
406
- * "unixVer": "4.18"
407
- * },
408
- * "ios": {
409
- * "osVer": "12.0",
410
- * "uniVer": "x",
411
- * "unixVer": "4.18"
412
- * },
413
- * "harmony": {
414
- * "osVer": "x",
415
- * "uniVer": "x",
416
- * "unixVer": "x"
417
- * }
418
- * },
419
- * "web": {
420
- * "uniVer": "x",
421
- * "unixVer": "x"
422
- * }
423
- * }
424
- */
425
- fail? : SetAppThemeFailCallback
426
- /**
427
- * 接口调用结束的回调函数(调用成功、失败都会执行)
428
- * @defaultValue null
429
- * @uniPlatform
430
- * {
431
- * "app": {
432
- * "android": {
433
- * "osVer": "5.0",
434
- * "uniVer": "x",
435
- * "unixVer": "4.18"
436
- * },
437
- * "ios": {
438
- * "osVer": "12.0",
439
- * "uniVer": "x",
440
- * "unixVer": "4.18"
441
- * },
442
- * "harmony": {
443
- * "osVer": "x",
444
- * "uniVer": "x",
445
- * "unixVer": "x"
446
- * }
447
- * },
448
- * "web": {
449
- * "uniVer": "x",
450
- * "unixVer": "x"
451
- * }
452
- * }
453
- */
454
- complete? : SetAppThemeCompleteCallback
455
- }
456
-
457
- /**
458
- * 错误码
459
- * - 702001 参数错误
460
- * - 2002000 未知错误
461
- * @uniPlatform
462
- * {
463
- * "app": {
464
- * "android": {
465
- * "osVer": "5.0",
466
- * "uniVer": "x",
467
- * "unixVer": "4.18"
468
- * },
469
- * "ios": {
470
- * "osVer": "12.0",
471
- * "uniVer": "x",
472
- * "unixVer": "4.18"
473
- * },
474
- * "harmony": {
475
- * "osVer": "x",
476
- * "uniVer": "x",
477
- * "unixVer": "x"
478
- * }
479
- * },
480
- * "web": {
481
- * "uniVer": "x",
482
- * "unixVer": "x"
483
- * }
484
- * }
485
- */
486
- export type AppThemeErrorCode = 702001 | 2002000;
487
- export type AppThemeFail = IAppThemeFail;
488
- /**
489
- * @uniPlatform
490
- * {
491
- * "app": {
492
- * "android": {
493
- * "osVer": "5.0",
494
- * "uniVer": "x",
495
- * "unixVer": "4.18"
496
- * },
497
- * "ios": {
498
- * "osVer": "12.0",
499
- * "uniVer": "x",
500
- * "unixVer": "4.18"
501
- * },
502
- * "harmony": {
503
- * "osVer": "x",
504
- * "uniVer": "x",
505
- * "unixVer": "x"
506
- * }
507
- * },
508
- * "web": {
509
- * "uniVer": "x",
510
- * "unixVer": "x"
511
- * }
512
- * }
513
- */
514
- export interface IAppThemeFail extends IUniError {
515
- errCode : AppThemeErrorCode
516
- };
1
+ export interface Uni {
2
+ /**
3
+ * 开启监听系统主题变化
4
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onosthemechange
5
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onosthemechange
6
+ * @uniPlatform
7
+ {
8
+ "app": {
9
+ "android": {
10
+ "osVer": "5.0",
11
+ "uniVer": "x",
12
+ "uniUtsPlugin": "x",
13
+ "unixVer": "4.18",
14
+ "unixUtsPlugin": "4.18"
15
+ },
16
+ "ios": {
17
+ "osVer": "12.0",
18
+ "uniVer": "x",
19
+ "uniUtsPlugin": "x",
20
+ "unixVer": "4.18",
21
+ "unixUtsPlugin": "4.18"
22
+ },
23
+ "harmony": {
24
+ "osVer": "x",
25
+ "uniVer": "x",
26
+ "unixVer": "x"
27
+ }
28
+ },
29
+ "mp": {
30
+ "weixin": {
31
+ "hostVer": "x",
32
+ "uniVer": "x",
33
+ "unixVer": "x"
34
+ },
35
+ "alipay": {
36
+ "hostVer": "x",
37
+ "uniVer": "x",
38
+ "unixVer": "x"
39
+ },
40
+ "baidu": {
41
+ "hostVer": "x",
42
+ "uniVer": "x",
43
+ "unixVer": "x"
44
+ },
45
+ "toutiao": {
46
+ "hostVer": "x",
47
+ "uniVer": "x",
48
+ "unixVer": "x"
49
+ },
50
+ "lark": {
51
+ "hostVer": "x",
52
+ "uniVer": "x",
53
+ "unixVer": "x"
54
+ },
55
+ "qq": {
56
+ "hostVer": "x",
57
+ "uniVer": "x",
58
+ "unixVer": "x"
59
+ },
60
+ "kuaishou": {
61
+ "hostVer": "x",
62
+ "uniVer": "x",
63
+ "unixVer": "x"
64
+ },
65
+ "jd": {
66
+ "hostVer": "x",
67
+ "uniVer": "x",
68
+ "unixVer": "x"
69
+ }
70
+ },
71
+ "web": {
72
+ "uniVer": "x",
73
+ "unixVer": "x"
74
+ }
75
+ }
76
+ * @example
77
+ ```typescript
78
+ const id = uni.onOsThemeChange((res) => {
79
+ console.log(res.osTheme)
80
+ })
81
+ ```
82
+ */
83
+ onOsThemeChange(callback: OnOsThemeChangeCallback): number
84
+
85
+ /**
86
+ * 取消监听系统主题变化
87
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offosthemechange
88
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offosthemechange
89
+ * @uniPlatform
90
+ {
91
+ "app": {
92
+ "android": {
93
+ "osVer": "5.0",
94
+ "uniVer": "x",
95
+ "uniUtsPlugin": "x",
96
+ "unixVer": "4.18",
97
+ "unixUtsPlugin": "4.18"
98
+ },
99
+ "ios": {
100
+ "osVer": "12.0",
101
+ "uniVer": "x",
102
+ "uniUtsPlugin": "x",
103
+ "unixVer": "4.18",
104
+ "unixUtsPlugin": "4.18"
105
+ },
106
+ "harmony": {
107
+ "osVer": "x",
108
+ "uniVer": "x",
109
+ "unixVer": "x"
110
+ }
111
+ },
112
+ "mp": {
113
+ "weixin": {
114
+ "hostVer": "x",
115
+ "uniVer": "x",
116
+ "unixVer": "x"
117
+ },
118
+ "alipay": {
119
+ "hostVer": "x",
120
+ "uniVer": "x",
121
+ "unixVer": "x"
122
+ },
123
+ "baidu": {
124
+ "hostVer": "x",
125
+ "uniVer": "x",
126
+ "unixVer": "x"
127
+ },
128
+ "toutiao": {
129
+ "hostVer": "x",
130
+ "uniVer": "x",
131
+ "unixVer": "x"
132
+ },
133
+ "lark": {
134
+ "hostVer": "x",
135
+ "uniVer": "x",
136
+ "unixVer": "x"
137
+ },
138
+ "qq": {
139
+ "hostVer": "x",
140
+ "uniVer": "x",
141
+ "unixVer": "x"
142
+ },
143
+ "kuaishou": {
144
+ "hostVer": "x",
145
+ "uniVer": "x",
146
+ "unixVer": "x"
147
+ },
148
+ "jd": {
149
+ "hostVer": "x",
150
+ "uniVer": "x",
151
+ "unixVer": "x"
152
+ }
153
+ },
154
+ "web": {
155
+ "uniVer": "x",
156
+ "unixVer": "x"
157
+ }
158
+ }
159
+ * @example
160
+ ```typescript
161
+ uni.offOsThemeChange(id)
162
+ ```
163
+ */
164
+ offOsThemeChange(id: number): void
165
+
166
+ /**
167
+ * 设置应用主题
168
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#setapptheme
169
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#setapptheme
170
+ * @uniPlatform
171
+ {
172
+ "app": {
173
+ "android": {
174
+ "osVer": "5.0",
175
+ "uniVer": "x",
176
+ "uniUtsPlugin": "x",
177
+ "unixVer": "4.18",
178
+ "unixUtsPlugin": "4.18"
179
+ },
180
+ "ios": {
181
+ "osVer": "12.0",
182
+ "uniVer": "x",
183
+ "uniUtsPlugin": "x",
184
+ "unixVer": "4.18",
185
+ "unixUtsPlugin": "4.18"
186
+ }
187
+ },
188
+ "mp": {
189
+ "weixin": {
190
+ "hostVer": "x",
191
+ "uniVer": "x",
192
+ "unixVer": "x"
193
+ },
194
+ "alipay": {
195
+ "hostVer": "x",
196
+ "uniVer": "x",
197
+ "unixVer": "x"
198
+ },
199
+ "baidu": {
200
+ "hostVer": "x",
201
+ "uniVer": "x",
202
+ "unixVer": "x"
203
+ },
204
+ "toutiao": {
205
+ "hostVer": "x",
206
+ "uniVer": "x",
207
+ "unixVer": "x"
208
+ },
209
+ "lark": {
210
+ "hostVer": "x",
211
+ "uniVer": "x",
212
+ "unixVer": "x"
213
+ },
214
+ "qq": {
215
+ "hostVer": "x",
216
+ "uniVer": "x",
217
+ "unixVer": "x"
218
+ },
219
+ "kuaishou": {
220
+ "hostVer": "x",
221
+ "uniVer": "x",
222
+ "unixVer": "x"
223
+ },
224
+ "jd": {
225
+ "hostVer": "x",
226
+ "uniVer": "x",
227
+ "unixVer": "x"
228
+ }
229
+ },
230
+ "web": {
231
+ "uniVer": "x",
232
+ "unixVer": "x"
233
+ }
234
+ }
235
+ * @example
236
+ ```typescript
237
+ uni.setAppTheme({
238
+ theme: 'dark',
239
+ success: (res) => {
240
+ console.log('success')
241
+ },
242
+ fail: (err) => {
243
+ console.log(err)
244
+ },
245
+ complete: (res) => {
246
+ console.log('complete')
247
+ }
248
+ })
249
+ ```
250
+ */
251
+ setAppTheme(options: SetAppThemeOptions): void
252
+
253
+ /**
254
+ * 开启监听应用主题变化
255
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onappthemechange
256
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#onappthemechange
257
+ * @uniPlatform
258
+ {
259
+ "app": {
260
+ "android": {
261
+ "osVer": "5.0",
262
+ "uniVer": "x",
263
+ "uniUtsPlugin": "x",
264
+ "unixVer": "4.18",
265
+ "unixUtsPlugin": "4.18"
266
+ },
267
+ "ios": {
268
+ "osVer": "12.0",
269
+ "uniVer": "x",
270
+ "uniUtsPlugin": "x",
271
+ "unixVer": "4.18",
272
+ "unixUtsPlugin": "4.18"
273
+ }
274
+ },
275
+ "mp": {
276
+ "weixin": {
277
+ "hostVer": "x",
278
+ "uniVer": "x",
279
+ "unixVer": "x"
280
+ },
281
+ "alipay": {
282
+ "hostVer": "x",
283
+ "uniVer": "x",
284
+ "unixVer": "x"
285
+ },
286
+ "baidu": {
287
+ "hostVer": "x",
288
+ "uniVer": "x",
289
+ "unixVer": "x"
290
+ },
291
+ "toutiao": {
292
+ "hostVer": "x",
293
+ "uniVer": "x",
294
+ "unixVer": "x"
295
+ },
296
+ "lark": {
297
+ "hostVer": "x",
298
+ "uniVer": "x",
299
+ "unixVer": "x"
300
+ },
301
+ "qq": {
302
+ "hostVer": "x",
303
+ "uniVer": "x",
304
+ "unixVer": "x"
305
+ },
306
+ "kuaishou": {
307
+ "hostVer": "x",
308
+ "uniVer": "x",
309
+ "unixVer": "x"
310
+ },
311
+ "jd": {
312
+ "hostVer": "x",
313
+ "uniVer": "x",
314
+ "unixVer": "x"
315
+ }
316
+ },
317
+ "web": {
318
+ "uniVer": "x",
319
+ "unixVer": "x"
320
+ }
321
+ }
322
+ * @example
323
+ ```typescript
324
+ const id = uni.onAppThemeChange((res) => {
325
+ console.log(res.appTheme)
326
+ })
327
+ ```
328
+ */
329
+ onAppThemeChange(callback: OnAppThemeChangeCallback): number
330
+
331
+ /**
332
+ * 取消监听应用主题变化
333
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offappthemechange
334
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/theme.html#offappthemechange
335
+ * @uniPlatform
336
+ {
337
+ "app": {
338
+ "android": {
339
+ "osVer": "5.0",
340
+ "uniVer": "x",
341
+ "uniUtsPlugin": "x",
342
+ "unixVer": "4.18",
343
+ "unixUtsPlugin": "4.18"
344
+ },
345
+ "ios": {
346
+ "osVer": "12.0",
347
+ "uniVer": "x",
348
+ "uniUtsPlugin": "x",
349
+ "unixVer": "4.18",
350
+ "unixUtsPlugin": "4.18"
351
+ }
352
+ },
353
+ "web": {
354
+ "uniVer": "x",
355
+ "unixVer": "x"
356
+ }
357
+ }
358
+ * @example
359
+ ```typescript
360
+ uni.offAppThemeChange(id)
361
+ ```
362
+ */
363
+ offAppThemeChange(id: number): void
364
+
365
+ /**
366
+ * 监听宿主题状态变化。
367
+ * @tutorial https://uniapp.dcloud.io/api/system/theme.html#onhostthemechange
368
+ * @tutorial-uni-app https://uniapp.dcloud.io/api/system/theme.html#onhostthemechange
369
+ * @uniPlatform {
370
+ * "app": {
371
+ * "android": {
372
+ * "osVer": "5.0",
373
+ * "uniVer": "x",
374
+ * "unixVer": "4.35"
375
+ * },
376
+ * "ios": {
377
+ * "osVer": "9.0",
378
+ * "uniVer": "x",
379
+ * "unixVer": "4.35"
380
+ * },
381
+ * "harmony": {
382
+ * "osVer": "x",
383
+ * "uniVer": "x",
384
+ * "unixVer": "x"
385
+ * }
386
+ * },
387
+ * "mp": {
388
+ * "weixin": {
389
+ * "hostVer": "√",
390
+ * "uniVer": "x",
391
+ * "unixVer": "4.41"
392
+ * },
393
+ * "alipay": {
394
+ * "hostVer": "x",
395
+ * "uniVer": "x",
396
+ * "unixVer": "x"
397
+ * },
398
+ * "baidu": {
399
+ * "hostVer": "x",
400
+ * "uniVer": "x",
401
+ * "unixVer": "x"
402
+ * },
403
+ * "toutiao": {
404
+ * "hostVer": "x",
405
+ * "uniVer": "x",
406
+ * "unixVer": "x"
407
+ * },
408
+ * "lark": {
409
+ * "hostVer": "x",
410
+ * "uniVer": "x",
411
+ * "unixVer": "x"
412
+ * },
413
+ * "qq": {
414
+ * "hostVer": "x",
415
+ * "uniVer": "x",
416
+ * "unixVer": "x"
417
+ * },
418
+ * "kuaishou": {
419
+ * "hostVer": "x",
420
+ * "uniVer": "x",
421
+ * "unixVer": "x"
422
+ * },
423
+ * "jd": {
424
+ * "hostVer": "x",
425
+ * "uniVer": "x",
426
+ * "unixVer": "x"
427
+ * }
428
+ * },
429
+ * "web": {
430
+ * "uniVer": "x",
431
+ * "unixVer": "4.35"
432
+ * }
433
+ * }
434
+ */
435
+ onHostThemeChange(callback: OnHostThemeChangeCallback): number;
436
+ /**
437
+ * 取消监听宿主题状态变化。
438
+ * @tutorial https://uniapp.dcloud.io/api/system/theme.html#offhostthemechange
439
+ * @tutorial-uni-app https://uniapp.dcloud.io/api/system/theme.html#offhostthemechange
440
+ * @uniPlatform {
441
+ * "app": {
442
+ * "android": {
443
+ * "osVer": "5.0",
444
+ * "uniVer": "x",
445
+ * "unixVer": "4.35"
446
+ * },
447
+ * "ios": {
448
+ * "osVer": "9.0",
449
+ * "uniVer": "x",
450
+ * "unixVer": "4.35"
451
+ * },
452
+ * "harmony": {
453
+ * "osVer": "x",
454
+ * "uniVer": "x",
455
+ * "unixVer": "x"
456
+ * }
457
+ * },
458
+ * "mp": {
459
+ * "weixin": {
460
+ * "hostVer": "x",
461
+ * "uniVer": "x",
462
+ * "unixVer": "4.41"
463
+ * },
464
+ * "alipay": {
465
+ * "hostVer": "x",
466
+ * "uniVer": "x",
467
+ * "unixVer": "x"
468
+ * },
469
+ * "baidu": {
470
+ * "hostVer": "x",
471
+ * "uniVer": "x",
472
+ * "unixVer": "x"
473
+ * },
474
+ * "toutiao": {
475
+ * "hostVer": "x",
476
+ * "uniVer": "x",
477
+ * "unixVer": "x"
478
+ * },
479
+ * "lark": {
480
+ * "hostVer": "x",
481
+ * "uniVer": "x",
482
+ * "unixVer": "x"
483
+ * },
484
+ * "qq": {
485
+ * "hostVer": "x",
486
+ * "uniVer": "x",
487
+ * "unixVer": "x"
488
+ * },
489
+ * "kuaishou": {
490
+ * "hostVer": "x",
491
+ * "uniVer": "x",
492
+ * "unixVer": "x"
493
+ * },
494
+ * "jd": {
495
+ * "hostVer": "x",
496
+ * "uniVer": "x",
497
+ * "unixVer": "x"
498
+ * }
499
+ * },
500
+ * "web": {
501
+ * "uniVer": "x",
502
+ * "unixVer": "4.35"
503
+ * }
504
+ * }
505
+ */
506
+ offHostThemeChange(id: number): void;
507
+
508
+
509
+ /**
510
+ * 监听系统主题状态变化。
511
+ * @deprecated 已废弃,在web、小程序上推荐使用 onHostThemeChange
512
+ * @tutorial https://uniapp.dcloud.io/api/system/theme.html#onthemechange
513
+ * @tutorial-uni-app https://uniapp.dcloud.io/api/system/theme.html#onthemechange
514
+ * @uniPlatform {
515
+ * "app": {
516
+ * "android": {
517
+ * "osVer": "5.0",
518
+ * "uniVer": "3.6.9",
519
+ * "unixVer": "x"
520
+ * },
521
+ * "ios": {
522
+ * "osVer": "9.0",
523
+ * "uniVer": "2.6.5",
524
+ * "unixVer": "x"
525
+ * },
526
+ * "harmony": {
527
+ * "osVer": "x",
528
+ * "uniVer": "x",
529
+ * "unixVer": "x"
530
+ * }
531
+ * },
532
+ * "mp": {
533
+ * "weixin": {
534
+ * "hostVer": "√",
535
+ * "uniVer": "2.11.0",
536
+ * "unixVer": "x"
537
+ * },
538
+ * "alipay": {
539
+ * "hostVer": "x",
540
+ * "uniVer": "x",
541
+ * "unixVer": "x"
542
+ * },
543
+ * "baidu": {
544
+ * "hostVer": "x",
545
+ * "uniVer": "x",
546
+ * "unixVer": "x"
547
+ * },
548
+ * "toutiao": {
549
+ * "hostVer": "x",
550
+ * "uniVer": "x",
551
+ * "unixVer": "x"
552
+ * },
553
+ * "lark": {
554
+ * "hostVer": "√",
555
+ * "uniVer": "5.3.0",
556
+ * "unixVer": "x"
557
+ * },
558
+ * "qq": {
559
+ * "hostVer": "x",
560
+ * "uniVer": "x",
561
+ * "unixVer": "x"
562
+ * },
563
+ * "kuaishou": {
564
+ * "hostVer": "x",
565
+ * "uniVer": "x",
566
+ * "unixVer": "x"
567
+ * },
568
+ * "jd": {
569
+ * "hostVer": "x",
570
+ * "uniVer": "x",
571
+ * "unixVer": "x"
572
+ * }
573
+ * },
574
+ * "web": {
575
+ * "uniVer": "3.6.9",
576
+ * "unixVer": "4.0"
577
+ * }
578
+ * }
579
+ */
580
+ onThemeChange(callback: OnThemeChangeCallback): void;
581
+ /**
582
+ * 取消监听系统主题状态变化。
583
+ * @deprecated 已废弃,在web、小程序上推荐使用 offHostThemeChange
584
+ * @tutorial https://uniapp.dcloud.io/api/system/theme.html#offthemechange
585
+ * @tutorial-uni-app https://uniapp.dcloud.io/api/system/theme.html#offthemechange
586
+ * @uniPlatform {
587
+ * "app": {
588
+ * "android": {
589
+ * "osVer": "5.0",
590
+ * "uniVer": "3.6.9",
591
+ * "unixVer": "x"
592
+ * },
593
+ * "ios": {
594
+ * "osVer": "9.0",
595
+ * "uniVer": "2.6.5",
596
+ * "unixVer": "x"
597
+ * },
598
+ * "harmony": {
599
+ * "osVer": "x",
600
+ * "uniVer": "x",
601
+ * "unixVer": "x"
602
+ * }
603
+ * },
604
+ * "mp": {
605
+ * "weixin": {
606
+ * "hostVer": "√",
607
+ * "uniVer": "2.11.0",
608
+ * "unixVer": "x"
609
+ * },
610
+ * "alipay": {
611
+ * "hostVer": "x",
612
+ * "uniVer": "x",
613
+ * "unixVer": "x"
614
+ * },
615
+ * "baidu": {
616
+ * "hostVer": "x",
617
+ * "uniVer": "x",
618
+ * "unixVer": "x"
619
+ * },
620
+ * "toutiao": {
621
+ * "hostVer": "x",
622
+ * "uniVer": "x",
623
+ * "unixVer": "x"
624
+ * },
625
+ * "lark": {
626
+ * "hostVer": "√",
627
+ * "uniVer": "5.3.0",
628
+ * "unixVer": "x"
629
+ * },
630
+ * "qq": {
631
+ * "hostVer": "x",
632
+ * "uniVer": "x",
633
+ * "unixVer": "x"
634
+ * },
635
+ * "kuaishou": {
636
+ * "hostVer": "x",
637
+ * "uniVer": "x",
638
+ * "unixVer": "x"
639
+ * },
640
+ * "jd": {
641
+ * "hostVer": "x",
642
+ * "uniVer": "x",
643
+ * "unixVer": "x"
644
+ * }
645
+ * },
646
+ * "web": {
647
+ * "uniVer": "3.6.9",
648
+ * "unixVer": "4.0"
649
+ * }
650
+ * }
651
+ */
652
+ offThemeChange(callback: OnThemeChangeCallback): void;
653
+ }
654
+
655
+ /**
656
+ * @uniPlatform
657
+ {
658
+ "app": {
659
+ "android": {
660
+ "osVer": "5.0",
661
+ "uniVer": "x",
662
+ "uniUtsPlugin": "x",
663
+ "unixVer": "4.18",
664
+ "unixUtsPlugin": "4.18"
665
+ },
666
+ "ios": {
667
+ "osVer": "12.0",
668
+ "uniVer": "x",
669
+ "uniUtsPlugin": "x",
670
+ "unixVer": "4.18",
671
+ "unixUtsPlugin": "4.18"
672
+ },
673
+ "harmony": {
674
+ "osVer": "x",
675
+ "uniVer": "x",
676
+ "unixVer": "x"
677
+ }
678
+ },
679
+ "web": {
680
+ "uniVer": "x",
681
+ "unixVer": "x"
682
+ }
683
+ }
684
+ */
685
+ export type OsThemeChangeResult = {
686
+ /**
687
+ * 系统主题
688
+ * @uniPlatform
689
+ {
690
+ "app": {
691
+ "android": {
692
+ "osVer": "5.0",
693
+ "uniVer": "x",
694
+ "uniUtsPlugin": "x",
695
+ "unixVer": "4.18",
696
+ "unixUtsPlugin": "4.18"
697
+ },
698
+ "ios": {
699
+ "osVer": "12.0",
700
+ "uniVer": "x",
701
+ "uniUtsPlugin": "x",
702
+ "unixVer": "4.18",
703
+ "unixUtsPlugin": "4.18"
704
+ },
705
+ "harmony": {
706
+ "osVer": "x",
707
+ "uniVer": "x",
708
+ "unixVer": "x"
709
+ }
710
+ },
711
+ "web": {
712
+ "uniVer": "x",
713
+ "unixVer": "x"
714
+ }
715
+ }
716
+ */
717
+ osTheme: string
718
+ }
719
+
720
+ /**
721
+ * @uniPlatform
722
+ {
723
+ "app": {
724
+ "android": {
725
+ "osVer": "5.0",
726
+ "uniVer": "x",
727
+ "uniUtsPlugin": "x",
728
+ "unixVer": "4.18",
729
+ "unixUtsPlugin": "4.18"
730
+ },
731
+ "ios": {
732
+ "osVer": "12.0",
733
+ "uniVer": "x",
734
+ "uniUtsPlugin": "x",
735
+ "unixVer": "4.18",
736
+ "unixUtsPlugin": "4.18"
737
+ },
738
+ "harmony": {
739
+ "osVer": "x",
740
+ "uniVer": "x",
741
+ "unixVer": "x"
742
+ }
743
+ },
744
+ "web": {
745
+ "uniVer": "x",
746
+ "unixVer": "x"
747
+ }
748
+ }
749
+ */
750
+ export type AppThemeChangeResult = {
751
+ /**
752
+ * 应用主题
753
+ * @uniPlatform
754
+ {
755
+ "app": {
756
+ "android": {
757
+ "osVer": "5.0",
758
+ "uniVer": "x",
759
+ "uniUtsPlugin": "x",
760
+ "unixVer": "4.18",
761
+ "unixUtsPlugin": "4.18"
762
+ },
763
+ "ios": {
764
+ "osVer": "12.0",
765
+ "uniVer": "x",
766
+ "uniUtsPlugin": "x",
767
+ "unixVer": "4.18",
768
+ "unixUtsPlugin": "4.18"
769
+ },
770
+ "harmony": {
771
+ "osVer": "x",
772
+ "uniVer": "x",
773
+ "unixVer": "x"
774
+ }
775
+ },
776
+ "web": {
777
+ "uniVer": "x",
778
+ "unixVer": "x"
779
+ }
780
+ }
781
+ */
782
+ appTheme: string
783
+ }
784
+
785
+ /*
786
+ * 系统主题相关类型定义
787
+ */
788
+ export type OnOsThemeChangeCallback = (res: OsThemeChangeResult) => void
789
+ export type OnOsThemeChange = (callback: OnOsThemeChangeCallback) => number
790
+ export type OffOsThemeChange = (id: number) => void
791
+
792
+ /*
793
+ * 应用主题相关类型定义
794
+ */
795
+ export type SetAppTheme = (options: SetAppThemeOptions) => void
796
+ export type OnAppThemeChangeCallback = (res: AppThemeChangeResult) => void
797
+ export type OnAppThemeChange = (callback: OnAppThemeChangeCallback) => number
798
+ export type OffAppThemeChange = (id: number) => void
799
+ export type SetAppThemeSuccessResult = {
800
+ theme: string
801
+ }
802
+ export type SetAppThemeSuccessCallback = (result: SetAppThemeSuccessResult) => void;
803
+ export type SetAppThemeFailCallback = (result: AppThemeFail) => void;
804
+ export type SetAppThemeCompleteCallback = (result: any) => void;
805
+
806
+ /**
807
+ * @uniPlatform
808
+ {
809
+ "app": {
810
+ "android": {
811
+ "osVer": "5.0",
812
+ "uniVer": "x",
813
+ "uniUtsPlugin": "x",
814
+ "unixVer": "4.18",
815
+ "unixUtsPlugin": "4.18"
816
+ },
817
+ "ios": {
818
+ "osVer": "12.0",
819
+ "uniVer": "x",
820
+ "uniUtsPlugin": "x",
821
+ "unixVer": "4.18",
822
+ "unixUtsPlugin": "4.18"
823
+ },
824
+ "harmony": {
825
+ "osVer": "x",
826
+ "uniVer": "x",
827
+ "unixVer": "x"
828
+ }
829
+ },
830
+ "web": {
831
+ "uniVer": "x",
832
+ "unixVer": "x"
833
+ }
834
+ }
835
+ */
836
+ export type SetAppThemeOptions = {
837
+ /**
838
+ * 主题
839
+ * @uniPlatform
840
+ {
841
+ "app": {
842
+ "android": {
843
+ "osVer": "5.0",
844
+ "uniVer": "x",
845
+ "uniUtsPlugin": "x",
846
+ "unixVer": "4.18",
847
+ "unixUtsPlugin": "4.18"
848
+ },
849
+ "ios": {
850
+ "osVer": "12.0",
851
+ "uniVer": "x",
852
+ "uniUtsPlugin": "x",
853
+ "unixVer": "4.18",
854
+ "unixUtsPlugin": "4.18"
855
+ },
856
+ "harmony": {
857
+ "osVer": "x",
858
+ "uniVer": "x",
859
+ "unixVer": "x"
860
+ }
861
+ },
862
+ "web": {
863
+ "uniVer": "x",
864
+ "unixVer": "x"
865
+ }
866
+ }
867
+ */
868
+ theme: 'light' | 'dark' | 'auto'
869
+
870
+ /**
871
+ * 接口调用成功的回调函数
872
+ * @defaultValue null
873
+ * @uniPlatform
874
+ {
875
+ "app": {
876
+ "android": {
877
+ "osVer": "5.0",
878
+ "uniVer": "x",
879
+ "uniUtsPlugin": "x",
880
+ "unixVer": "4.18",
881
+ "unixUtsPlugin": "4.18"
882
+ },
883
+ "ios": {
884
+ "osVer": "12.0",
885
+ "uniVer": "x",
886
+ "uniUtsPlugin": "x",
887
+ "unixVer": "4.18",
888
+ "unixUtsPlugin": "4.18"
889
+ },
890
+ "harmony": {
891
+ "osVer": "x",
892
+ "uniVer": "x",
893
+ "unixVer": "x"
894
+ }
895
+ },
896
+ "web": {
897
+ "uniVer": "x",
898
+ "unixVer": "x"
899
+ }
900
+ }
901
+ */
902
+ success?: SetAppThemeSuccessCallback
903
+
904
+ /**
905
+ * 接口调用失败的回调函数
906
+ * @defaultValue null
907
+ * @uniPlatform
908
+ {
909
+ "app": {
910
+ "android": {
911
+ "osVer": "5.0",
912
+ "uniVer": "x",
913
+ "uniUtsPlugin": "x",
914
+ "unixVer": "4.18",
915
+ "unixUtsPlugin": "4.18"
916
+ },
917
+ "ios": {
918
+ "osVer": "12.0",
919
+ "uniVer": "x",
920
+ "uniUtsPlugin": "x",
921
+ "unixVer": "4.18",
922
+ "unixUtsPlugin": "4.18"
923
+ },
924
+ "harmony": {
925
+ "osVer": "x",
926
+ "uniVer": "x",
927
+ "unixVer": "x"
928
+ }
929
+ },
930
+ "web": {
931
+ "uniVer": "x",
932
+ "unixVer": "x"
933
+ }
934
+ }
935
+ */
936
+ fail?: SetAppThemeFailCallback
937
+
938
+ /**
939
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
940
+ * @defaultValue null
941
+ * @uniPlatform
942
+ {
943
+ "app": {
944
+ "android": {
945
+ "osVer": "5.0",
946
+ "uniVer": "x",
947
+ "uniUtsPlugin": "x",
948
+ "unixVer": "4.18",
949
+ "unixUtsPlugin": "4.18"
950
+ },
951
+ "ios": {
952
+ "osVer": "12.0",
953
+ "uniVer": "x",
954
+ "uniUtsPlugin": "x",
955
+ "unixVer": "4.18",
956
+ "unixUtsPlugin": "4.18"
957
+ },
958
+ "harmony": {
959
+ "osVer": "x",
960
+ "uniVer": "x",
961
+ "unixVer": "x"
962
+ }
963
+ },
964
+ "web": {
965
+ "uniVer": "x",
966
+ "unixVer": "x"
967
+ }
968
+ }
969
+ */
970
+ complete?: SetAppThemeCompleteCallback
971
+ }
972
+
973
+ /**
974
+ * 错误码
975
+ * - 702001 参数错误
976
+ * - 2002000 未知错误
977
+ * @uniPlatform
978
+ {
979
+ "app": {
980
+ "android": {
981
+ "osVer": "5.0",
982
+ "uniVer": "x",
983
+ "uniUtsPlugin": "x",
984
+ "unixVer": "4.18",
985
+ "unixUtsPlugin": "4.18"
986
+ },
987
+ "ios": {
988
+ "osVer": "12.0",
989
+ "uniVer": "x",
990
+ "uniUtsPlugin": "x",
991
+ "unixVer": "4.18",
992
+ "unixUtsPlugin": "4.18"
993
+ },
994
+ "harmony": {
995
+ "osVer": "x",
996
+ "uniVer": "x",
997
+ "unixVer": "x"
998
+ }
999
+ },
1000
+ "web": {
1001
+ "uniVer": "x",
1002
+ "unixVer": "x"
1003
+ }
1004
+ }
1005
+ */
1006
+ export type AppThemeErrorCode = 702001 | 2002000;
1007
+ export type AppThemeFail = IAppThemeFail;
1008
+ /**
1009
+ * @uniPlatform
1010
+ {
1011
+ "app": {
1012
+ "android": {
1013
+ "osVer": "5.0",
1014
+ "uniVer": "x",
1015
+ "uniUtsPlugin": "x",
1016
+ "unixVer": "4.18",
1017
+ "unixUtsPlugin": "4.18"
1018
+ },
1019
+ "ios": {
1020
+ "osVer": "12.0",
1021
+ "uniVer": "x",
1022
+ "uniUtsPlugin": "x",
1023
+ "unixVer": "4.18",
1024
+ "unixUtsPlugin": "4.18"
1025
+ },
1026
+ "harmony": {
1027
+ "osVer": "x",
1028
+ "uniVer": "x",
1029
+ "unixVer": "x"
1030
+ }
1031
+ },
1032
+ "web": {
1033
+ "uniVer": "x",
1034
+ "unixVer": "x"
1035
+ }
1036
+ }
1037
+ */
1038
+ export interface IAppThemeFail extends IUniError {
1039
+ errCode: AppThemeErrorCode
1040
+ };
1041
+
1042
+ export type OnHostThemeChangeCallbackResult = {
1043
+ /**
1044
+ * 主题名称
1045
+ */
1046
+ hostTheme: 'dark' | 'light'
1047
+ };
1048
+ export type OnHostThemeChangeCallback = (result: OnHostThemeChangeCallbackResult) => void;
1049
+
1050
+
1051
+ export type OnThemeChangeCallbackResult = {
1052
+ /**
1053
+ * 主题名称
1054
+ */
1055
+ theme: 'dark' | 'light'
1056
+ };
1057
+ export type OnThemeChangeCallback = (result: OnHostThemeChangeCallbackResult) => void;