@dcloudio/uni-app-x 0.5.0 → 0.5.2

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 (108) hide show
  1. package/README.md +39 -0
  2. package/package.json +5 -3
  3. package/types/app.d.ts +26 -72
  4. package/types/native/CSSStyleDeclaration.d.ts +2 -2
  5. package/types/native/DOMRect.d.ts +4 -4
  6. package/types/native/DomNode.d.ts +48 -0
  7. package/types/native/DrawableContext.d.ts +42 -16
  8. package/types/native/Element.d.ts +234 -0
  9. package/types/native/Event.d.ts +14 -3
  10. package/types/native/IDocument.d.ts +6 -6
  11. package/types/native/IPage.d.ts +28 -10
  12. package/types/native/IPageManager.d.ts +2 -2
  13. package/types/native/ITabsNode.d.ts +4 -4
  14. package/types/native/IUniError.d.ts +20 -0
  15. package/types/native/IWebViewNode.d.ts +2 -2
  16. package/types/native/InputBlurEvent.d.ts +13 -0
  17. package/types/native/InputConfirmEvent.d.ts +13 -0
  18. package/types/native/InputEvent.d.ts +21 -0
  19. package/types/native/InputFocusEvent.d.ts +17 -0
  20. package/types/native/InputKeyboardHeightChangeEvent.d.ts +17 -0
  21. package/types/native/MouseEvent.d.ts +13 -1
  22. package/types/native/NestedPreScrollEvent.d.ts +23 -0
  23. package/types/native/ScrollToLowerEvent.d.ts +4 -1
  24. package/types/native/ScrollToUpperEvent.d.ts +5 -2
  25. package/types/native/StartNestedScrollEvent.d.ts +12 -0
  26. package/types/native/SwiperAnimationFinishEvent.d.ts +11 -0
  27. package/types/native/SwiperChangeEvent.d.ts +11 -0
  28. package/types/native/SwiperTransitionEvent.d.ts +11 -0
  29. package/types/native/TextareaBlurEvent.d.ts +17 -0
  30. package/types/native/TextareaFocusEvent.d.ts +17 -0
  31. package/types/native/TextareaLineChangeEvent.d.ts +21 -0
  32. package/types/native/UniError.d.ts +7 -2
  33. package/types/native/index.d.ts +18 -1
  34. package/types/page.d.ts +38 -193
  35. package/types/uni/core/index.d.ts +9 -8
  36. package/types/uni/core/lib/base/event/interface.d.ts +4 -4
  37. package/types/uni/core/lib/lifecycle/interface.d.ts +1 -1
  38. package/types/uni/core/lib/route/index.d.ts +0 -10
  39. package/types/uni/core/lib/route/interface.d.ts +1805 -10
  40. package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +242 -2
  41. package/types/uni/core/lib/ui/get-element-by-id/index.d.ts +9 -0
  42. package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +72 -0
  43. package/types/uni/core/lib/ui/load-font-face/interface.d.ts +486 -3
  44. package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +0 -2
  45. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +93 -9
  46. package/types/uni/core/lib/ui/pull-down-refresh/index.d.ts +0 -2
  47. package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +2 -5
  48. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +373 -4
  49. package/types/uni/core/lib/ui/tab-bar/index.d.ts +2 -18
  50. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +32 -35
  51. package/types/uni/index.d.ts +2 -1
  52. package/types/uni/{ext → uts-plugin-api}/index.d.ts +18 -17
  53. package/types/uni/{ext → uts-plugin-api}/lib/uni-audio/utssdk/interface.d.ts +2 -2
  54. package/types/uni/{ext → uts-plugin-api}/lib/uni-createWebviewContext/utssdk/interface.d.ts +9 -9
  55. package/types/uni/{ext → uts-plugin-api}/lib/uni-exit/utssdk/interface.d.ts +1 -1
  56. package/types/uni/{ext → uts-plugin-api}/lib/uni-file-manager/utssdk/interface.d.ts +2 -2
  57. package/types/uni/{ext → uts-plugin-api}/lib/uni-getAccessibilityInfo/utssdk/interface.d.ts +1 -1
  58. package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +108 -10
  59. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +233 -0
  60. package/types/uni/{ext → uts-plugin-api}/lib/uni-getDeviceInfo/utssdk/interface.d.ts +58 -46
  61. package/types/uni/{ext → uts-plugin-api}/lib/uni-getLocation-system/utssdk/interface.d.ts +13 -1
  62. package/types/uni/{ext → uts-plugin-api}/lib/uni-getNetworkType/utssdk/interface.d.ts +8 -5
  63. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +213 -0
  64. package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemInfo/utssdk/interface.d.ts +108 -36
  65. package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemSetting/utssdk/interface.d.ts +3 -3
  66. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +794 -0
  67. package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/app-ios/interface.d.ts +60 -19
  68. package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/index.d.ts +4 -0
  69. package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/interface.d.ts +138 -49
  70. package/types/uni/{ext → uts-plugin-api}/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +8 -5
  71. package/types/uni/{ext → uts-plugin-api}/lib/uni-prompt/utssdk/interface.d.ts +6 -6
  72. package/types/uni/{ext → uts-plugin-api}/lib/uni-storage/utssdk/interface.d.ts +27 -27
  73. package/types/uni/{ext → uts-plugin-api}/lib/uni-websocket/utssdk/index.d.ts +2 -0
  74. package/types/uni/{ext → uts-plugin-api}/lib/uni-websocket/utssdk/interface.d.ts +60 -35
  75. package/types/uni/uts-plugin-component/index.d.ts +1 -0
  76. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +15 -0
  77. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +171 -0
  78. package/types/uni-cloud/index.d.ts +59 -330
  79. package/types/uni-cloud/interface.d.ts +786 -0
  80. package/types/vue/CheckboxGroupChangeEvent.d.ts +1 -1
  81. package/types/vue/PickerViewChangeEvent.d.ts +1 -1
  82. package/types/vue/ProgressActiveendEvent.d.ts +1 -1
  83. package/types/vue/RadioGroupChangeEvent.d.ts +1 -1
  84. package/types/vue/SliderChangeEvent.d.ts +10 -1
  85. package/types/vue/SwitchChangeEvent.d.ts +1 -1
  86. package/uts-plugin.d.ts +10 -0
  87. package/types/native/INode.d.ts +0 -181
  88. package/types/uni/ext/lib/uni-file-manager/utssdk/index.d.ts +0 -31
  89. package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +0 -120
  90. package/types/uni/ext/lib/uni-getRecorderManager/utssdk/interface.d.ts +0 -213
  91. package/types/uni/ext/lib/uni-media/utssdk/interface.d.ts +0 -795
  92. /package/types/uni/{ext → uts-plugin-api}/lib/uni-audio/utssdk/index.d.ts +0 -0
  93. /package/types/uni/{ext → uts-plugin-api}/lib/uni-createWebviewContext/utssdk/index.d.ts +0 -0
  94. /package/types/uni/{ext → uts-plugin-api}/lib/uni-exit/utssdk/index.d.ts +0 -0
  95. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +0 -0
  96. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +0 -0
  97. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppBaseInfo/utssdk/index.d.ts +0 -0
  98. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getDeviceInfo/utssdk/index.d.ts +0 -0
  99. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getLocation-system/utssdk/index.d.ts +0 -0
  100. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getNetworkType/utssdk/index.d.ts +0 -0
  101. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getRecorderManager/utssdk/index.d.ts +0 -0
  102. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemInfo/utssdk/index.d.ts +0 -0
  103. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemSetting/utssdk/index.d.ts +0 -0
  104. /package/types/uni/{ext → uts-plugin-api}/lib/uni-media/utssdk/index.d.ts +0 -0
  105. /package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/app-ios/index.d.ts +0 -0
  106. /package/types/uni/{ext → uts-plugin-api}/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +0 -0
  107. /package/types/uni/{ext → uts-plugin-api}/lib/uni-prompt/utssdk/index.d.ts +0 -0
  108. /package/types/uni/{ext → uts-plugin-api}/lib/uni-storage/utssdk/index.d.ts +0 -0
@@ -22,7 +22,7 @@ export type SetStorageCompleteCallback = (res: any) => void
22
22
  */
23
23
  export type SetStorageOptions = {
24
24
  /**
25
- * 本地缓存中的指定的 key
25
+ * 本地存储中的指定的 key
26
26
  */
27
27
  key: string,
28
28
  /**
@@ -75,7 +75,7 @@ export type GetStorageCompleteCallback = (res: any) => void
75
75
  */
76
76
  export type GetStorageOptions = {
77
77
  /**
78
- * 本地缓存中的指定的 key
78
+ * 本地存储中的指定的 key
79
79
  */
80
80
  key: string,
81
81
  /**
@@ -136,15 +136,15 @@ export type GetStorageInfoOptions = {
136
136
  /**
137
137
  * 接口调用成功的回调函数
138
138
  */
139
- success: GetStorageInfoSuccessCallback | null,
139
+ success?: GetStorageInfoSuccessCallback | null,
140
140
  /**
141
141
  * 接口调用失败的回调函数
142
142
  */
143
- fail: GetStorageInfoFailCallback | null,
143
+ fail?: GetStorageInfoFailCallback | null,
144
144
  /**
145
145
  * 接口调用结束的回调函数(调用成功、失败都会执行)
146
146
  */
147
- complete: GetStorageInfoCompleteCallback | null
147
+ complete?: GetStorageInfoCompleteCallback | null
148
148
  }
149
149
 
150
150
 
@@ -175,7 +175,7 @@ export type RemoveStorageCompleteCallback = (res: any) => void
175
175
  */
176
176
  export type RemoveStorageOptions = {
177
177
  /**
178
- * 本地缓存中的指定的 key
178
+ * 本地存储中的指定的 key
179
179
  */
180
180
  key: string,
181
181
  /**
@@ -244,7 +244,7 @@ export type ClearStorageSync = () => void
244
244
  export interface Uni {
245
245
  /**
246
246
  * uni.setStorage函数定义
247
- * 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
247
+ * 将数据存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
248
248
  *
249
249
  * @param {SetStorageOptions} options
250
250
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage
@@ -265,12 +265,12 @@ export interface Uni {
265
265
  * @uniVersion 2.0.3
266
266
  * @uniVueVersion 2,3 //支持的vue版本
267
267
  */
268
- setStorage: SetStorage,
268
+ setStorage(options: SetStorageOptions) : void,
269
269
  /**
270
270
  * uni.setStorageSync函数定义
271
- * 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
271
+ * 将 data 存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
272
272
  *
273
- * @param {string} key 本地缓存中的指定的 key
273
+ * @param {string} key 本地storage存储中的指定的 key
274
274
  * @param {any} data 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象
275
275
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync
276
276
  * @uniPlatform {
@@ -290,10 +290,10 @@ export interface Uni {
290
290
  * @uniVersion 2.0.3
291
291
  * @uniVueVersion 2,3 //支持的vue版本
292
292
  */
293
- setStorageSync: SetStorageSync,
293
+ setStorageSync(key: string, data: any) : void,
294
294
  /**
295
295
  * uni.getStorage函数定义
296
- * 从本地缓存中异步获取指定 key 对应的内容。
296
+ * 从本地存储中异步获取指定 key 对应的内容。
297
297
  *
298
298
  * @param {GetStorageOptions} options
299
299
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage
@@ -314,12 +314,12 @@ export interface Uni {
314
314
  * @uniVersion 2.0.3
315
315
  * @uniVueVersion 2,3 //支持的vue版本
316
316
  */
317
- getStorage: GetStorage,
317
+ getStorage(options: GetStorageOptions) : void,
318
318
  /**
319
319
  * uni.getStorageSync函数定义
320
- * 从本地缓存中同步获取指定 key 对应的内容。
320
+ * 从本地存储中同步获取指定 key 对应的内容。
321
321
  *
322
- * @param {string} key 本地缓存中的指定的 key
322
+ * @param {string} key 本地存储中的指定的 key
323
323
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync
324
324
  * @uniPlatform {
325
325
  * "app": {
@@ -338,7 +338,7 @@ export interface Uni {
338
338
  * @uniVersion 2.0.3
339
339
  * @uniVueVersion 2,3 //支持的vue版本
340
340
  */
341
- getStorageSync: GetStorageSync,
341
+ getStorageSync(key: string) : any | null,
342
342
  /**
343
343
  * uni.getStorageInfo函数定义
344
344
  * 异步获取当前 storage 的相关信息。
@@ -362,7 +362,7 @@ export interface Uni {
362
362
  * @uniVersion 2.0.3
363
363
  * @uniVueVersion 2,3 //支持的vue版本
364
364
  */
365
- getStorageInfo: GetStorageInfo,
365
+ getStorageInfo(options: GetStorageInfoOptions) : void,
366
366
  /**
367
367
  * uni.getStorageInfoSync函数定义
368
368
  * 同步获取当前 storage 的相关信息。
@@ -387,10 +387,10 @@ export interface Uni {
387
387
  * @uniVersion 2.0.3
388
388
  * @uniVueVersion 2,3 //支持的vue版本
389
389
  */
390
- getStorageInfoSync: GetStorageInfoSync,
390
+ getStorageInfoSync() : GetStorageInfoSuccess,
391
391
  /**
392
392
  * uni.removeStorage函数定义
393
- * 从本地缓存中异步移除指定 key。
393
+ * 从本地存储中异步移除指定 key。
394
394
  *
395
395
  * @param {RemoveStorageOptions} options
396
396
  *
@@ -413,12 +413,12 @@ export interface Uni {
413
413
  * @uniVersion 2.0.3
414
414
  * @uniVueVersion 2,3 //支持的vue版本
415
415
  */
416
- removeStorage: RemoveStorage,
416
+ removeStorage(options: RemoveStorageOptions) : void,
417
417
  /**
418
418
  * uni.removeStorageSync函数定义
419
- * 从本地缓存中同步移除指定 key。
419
+ * 从本地存储中同步移除指定 key。
420
420
  *
421
- * @param {string} key 本地缓存中的指定的 key
421
+ * @param {string} key 本地存储中的指定的 key
422
422
  *
423
423
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync
424
424
  *
@@ -439,10 +439,10 @@ export interface Uni {
439
439
  * @uniVersion 2.0.3
440
440
  * @uniVueVersion 2,3 //支持的vue版本
441
441
  */
442
- removeStorageSync: RemoveStorageSync,
442
+ removeStorageSync(key: string) : void,
443
443
  /**
444
444
  * uni.clearStorage函数定义
445
- * 清理本地数据缓存。
445
+ * 清除本地数据存储。
446
446
  *
447
447
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage
448
448
  *
@@ -463,10 +463,10 @@ export interface Uni {
463
463
  * @uniVersion 2.0.3
464
464
  * @uniVueVersion 2,3 //支持的vue版本
465
465
  */
466
- clearStorage: ClearStorage,
466
+ clearStorage(option?: ClearStorageOptions | null) : void,
467
467
  /**
468
468
  * uni.clearStorageSync函数定义
469
- * 清理本地数据缓存。
469
+ * 清除本地数据存储。
470
470
  *
471
471
  * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync
472
472
  *
@@ -487,5 +487,5 @@ export interface Uni {
487
487
  * @uniVersion 2.0.3
488
488
  * @uniVueVersion 2,3 //支持的vue版本
489
489
  */
490
- clearStorageSync: ClearStorageSync
490
+ clearStorageSync() : void
491
491
  }
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ConnectSocket as ConnectSocketOrigin,
3
3
  ConnectSocketSuccess as ConnectSocketSuccessOrigin,
4
+ ConnectSocketErrorCode as ConnectSocketErrorCodeOrigin,
4
5
  ConnectSocketFail as ConnectSocketFailOrigin,
5
6
  ConnectSocketOptions as ConnectSocketOptionsOrigin,
6
7
  GeneralCallbackResult as GeneralCallbackResultOrigin,
@@ -27,6 +28,7 @@ import {
27
28
  declare global {
28
29
  type ConnectSocket = ConnectSocketOrigin
29
30
  type ConnectSocketSuccess = ConnectSocketSuccessOrigin
31
+ type ConnectSocketErrorCode = ConnectSocketErrorCodeOrigin
30
32
  type ConnectSocketFail = ConnectSocketFailOrigin
31
33
  type ConnectSocketOptions = ConnectSocketOptionsOrigin
32
34
  type GeneralCallbackResult = GeneralCallbackResultOrigin
@@ -16,7 +16,7 @@ export interface Uni {
16
16
  * "ios": {
17
17
  * "osVer": "9.0",
18
18
  * "uniVer": "√",
19
- * "unixVer": "3.9.0"
19
+ * "unixVer": "x"
20
20
  * }
21
21
  * }
22
22
  * }
@@ -30,7 +30,7 @@ export interface Uni {
30
30
  });
31
31
  ```
32
32
  */
33
- connectSocket: ConnectSocket;
33
+ connectSocket(options: ConnectSocketOptions): SocketTask;
34
34
  /**
35
35
  * OnSocketOpen()
36
36
  * @description
@@ -48,7 +48,7 @@ export interface Uni {
48
48
  * "ios": {
49
49
  * "osVer": "9.0",
50
50
  * "uniVer": "√",
51
- * "unixVer": "3.9.0"
51
+ * "unixVer": "x"
52
52
  * }
53
53
  * }
54
54
  * }
@@ -59,7 +59,7 @@ export interface Uni {
59
59
  });
60
60
  ```
61
61
  */
62
- onSocketOpen: OnSocketOpen;
62
+ onSocketOpen(options: OnSocketOpenCallback): void;
63
63
 
64
64
  /**
65
65
  * OnSocketError()
@@ -78,7 +78,7 @@ export interface Uni {
78
78
  * "ios": {
79
79
  * "osVer": "9.0",
80
80
  * "uniVer": "√",
81
- * "unixVer": "3.9.0"
81
+ * "unixVer": "x"
82
82
  * }
83
83
  * }
84
84
  * }
@@ -89,7 +89,7 @@ export interface Uni {
89
89
  });
90
90
  ```
91
91
  */
92
- onSocketError: OnSocketError;
92
+ onSocketError(callback: OnSocketErrorCallback): void;
93
93
 
94
94
  /**
95
95
  * SendSocketMessage()
@@ -108,7 +108,7 @@ export interface Uni {
108
108
  * "ios": {
109
109
  * "osVer": "9.0",
110
110
  * "uniVer": "√",
111
- * "unixVer": "3.9.0"
111
+ * "unixVer": "x"
112
112
  * }
113
113
  * }
114
114
  * }
@@ -119,7 +119,7 @@ export interface Uni {
119
119
  });
120
120
  ```
121
121
  */
122
- sendSocketMessage: SendSocketMessage;
122
+ sendSocketMessage(options: SendSocketMessageOptions): void;
123
123
  /**
124
124
  * OnSocketMessage()
125
125
  * @description
@@ -137,7 +137,7 @@ export interface Uni {
137
137
  * "ios": {
138
138
  * "osVer": "9.0",
139
139
  * "uniVer": "√",
140
- * "unixVer": "3.9.0"
140
+ * "unixVer": "x"
141
141
  * }
142
142
  * }
143
143
  * }
@@ -148,7 +148,7 @@ export interface Uni {
148
148
  });
149
149
  ```
150
150
  */
151
- onSocketMessage: OnSocketMessage;
151
+ onSocketMessage(callback: OnSocketMessageCallback): void;
152
152
  /**
153
153
  * CloseSocket()
154
154
  * @description
@@ -166,7 +166,7 @@ export interface Uni {
166
166
  * "ios": {
167
167
  * "osVer": "9.0",
168
168
  * "uniVer": "√",
169
- * "unixVer": "3.9.0"
169
+ * "unixVer": "x"
170
170
  * }
171
171
  * }
172
172
  * }
@@ -175,7 +175,7 @@ export interface Uni {
175
175
  uni.closeSocket();
176
176
  ```
177
177
  */
178
- closeSocket: CloseSocket;
178
+ closeSocket(options: CloseSocketOptions): void;
179
179
  /**
180
180
  * OnSocketClose()
181
181
  * @description
@@ -193,7 +193,7 @@ export interface Uni {
193
193
  * "ios": {
194
194
  * "osVer": "9.0",
195
195
  * "uniVer": "√",
196
- * "unixVer": "3.9.0"
196
+ * "unixVer": "x"
197
197
  * }
198
198
  * }
199
199
  * }
@@ -204,15 +204,27 @@ export interface Uni {
204
204
  });
205
205
  ```
206
206
  */
207
- onSocketClose: OnSocketClose;
207
+ onSocketClose(callback: OnSocketCloseCallback): void;
208
208
  }
209
209
 
210
210
  export type ConnectSocket = (options: ConnectSocketOptions) => SocketTask;
211
211
  export type ConnectSocketSuccess = {
212
212
  errMsg: string
213
213
  };
214
- type ConnectSocketSuccessCallback = (result: ConnectSocketSuccess) => void;
215
- export type ConnectSocketFail = UniError;
214
+ type ConnectSocketSuccessCallback = (result: ConnectSocketSuccess) => void;
215
+ /**
216
+ * 错误码
217
+ * - 600009 URL格式不合法
218
+ */
219
+ export type ConnectSocketErrorCode = 600009;
220
+
221
+ /**
222
+ * 连接调用失败的错误回调参数
223
+ */
224
+ export interface ConnectSocketFail extends IUniError {
225
+ errCode: ConnectSocketErrorCode;
226
+ };
227
+
216
228
  type ConnectSocketFailCallback = (result: ConnectSocketFail) => void;
217
229
  type ConnectSocketComplete = any;
218
230
  type ConnectSocketCompleteCallback = (result: ConnectSocketComplete) => void;
@@ -222,23 +234,28 @@ export type ConnectSocketOptions = {
222
234
  */
223
235
  url: string,
224
236
  /**
225
- * HTTP 请求 Header,header 中不能设置 Referer
237
+ * HTTP 请求 Header,header 中不能设置 Referer
238
+ * @defaultValue null
226
239
  */
227
240
  header: UTSJSONObject | null,
228
241
  /**
229
- * 子协议数组
242
+ * 子协议数组
243
+ * @defaultValue null
230
244
  */
231
245
  protocols: (string[]) | null,
232
246
  /**
233
- * 接口调用成功的回调函数
247
+ * 接口调用成功的回调函数
248
+ * @defaultValue null
234
249
  */
235
250
  success?: ConnectSocketSuccessCallback | null,
236
251
  /**
237
- * 接口调用失败的回调函数
252
+ * 接口调用失败的回调函数
253
+ * @defaultValue null
238
254
  */
239
255
  fail?: ConnectSocketFailCallback | null,
240
256
  /**
241
- * 接口调用结束的回调函数(调用成功、失败都会执行)
257
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
258
+ * @defaultValue null
242
259
  */
243
260
  complete?: ConnectSocketCompleteCallback | null
244
261
  };
@@ -256,37 +273,45 @@ export type SendSocketMessageOptions = {
256
273
  */
257
274
  data: any,
258
275
  /**
259
- * 接口调用成功的回调函数
276
+ * 接口调用成功的回调函数
277
+ * @defaultValue null
260
278
  */
261
279
  success?: ((result: GeneralCallbackResult) => void) | null,
262
280
  /**
263
- * 接口调用失败的回调函数
281
+ * 接口调用失败的回调函数
282
+ * @defaultValue null
264
283
  */
265
284
  fail?: ((result: GeneralCallbackResult) => void) | null,
266
285
  /**
267
- * 接口调用结束的回调函数(调用成功、失败都会执行)
286
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
287
+ * @defaultValue null
268
288
  */
269
289
  complete?: ((result: GeneralCallbackResult) => void) | null
270
290
  };
271
291
  export type CloseSocketOptions = {
272
292
  /**
273
- * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
293
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
294
+ * @defaultValue 1000
274
295
  */
275
296
  code?: number | null,
276
297
  /**
277
- * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
298
+ * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
299
+ * @defaultValue ""
278
300
  */
279
301
  reason?: string | null,
280
302
  /**
281
- * 接口调用成功的回调函数
303
+ * 接口调用成功的回调函数
304
+ * @defaultValue null
282
305
  */
283
306
  success?: ((result: GeneralCallbackResult) => void) | null,
284
307
  /**
285
- * 接口调用失败的回调函数
308
+ * 接口调用失败的回调函数
309
+ * @defaultValue null
286
310
  */
287
311
  fail?: ((result: GeneralCallbackResult) => void) | null,
288
312
  /**
289
- * 接口调用结束的回调函数(调用成功、失败都会执行)
313
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
314
+ * @defaultValue null
290
315
  */
291
316
  complete?: ((result: GeneralCallbackResult) => void) | null
292
317
  };
@@ -321,7 +346,7 @@ export interface SocketTask {
321
346
  * "ios": {
322
347
  * "osVer": "9.0",
323
348
  * "uniVer": "√",
324
- * "unixVer": "3.9.0"
349
+ * "unixVer": "x"
325
350
  * }
326
351
  * }
327
352
  * }
@@ -348,7 +373,7 @@ export interface SocketTask {
348
373
  * "ios": {
349
374
  * "osVer": "9.0",
350
375
  * "uniVer": "√",
351
- * "unixVer": "3.9.0"
376
+ * "unixVer": "x"
352
377
  * }
353
378
  * }
354
379
  * }
@@ -375,7 +400,7 @@ export interface SocketTask {
375
400
  * "ios": {
376
401
  * "osVer": "9.0",
377
402
  * "uniVer": "√",
378
- * "unixVer": "3.9.0"
403
+ * "unixVer": "x"
379
404
  * }
380
405
  * }
381
406
  * }
@@ -402,7 +427,7 @@ export interface SocketTask {
402
427
  * "ios": {
403
428
  * "osVer": "9.0",
404
429
  * "uniVer": "√",
405
- * "unixVer": "3.9.0"
430
+ * "unixVer": "x"
406
431
  * }
407
432
  * }
408
433
  * }
@@ -430,7 +455,7 @@ export interface SocketTask {
430
455
  * "ios": {
431
456
  * "osVer": "9.0",
432
457
  * "uniVer": "√",
433
- * "unixVer": "3.9.0"
458
+ * "unixVer": "x"
434
459
  * }
435
460
  * }
436
461
  * }
@@ -458,7 +483,7 @@ export interface SocketTask {
458
483
  * "ios": {
459
484
  * "osVer": "9.0",
460
485
  * "uniVer": "√",
461
- * "unixVer": "3.9.0"
486
+ * "unixVer": "x"
462
487
  * }
463
488
  * }
464
489
  * }
@@ -0,0 +1 @@
1
+ /// <reference path='./lib/uni-video/utssdk/index.d.ts' />
@@ -0,0 +1,15 @@
1
+ import {
2
+ CreateVideoContext as CreateVideoContextOrigin,
3
+ Danmu as DanmuOrigin,
4
+ RequestFullScreenOptions as RequestFullScreenOptionsOrigin,
5
+ VideoContext as VideoContextOrigin,
6
+ Uni as UniOrigin
7
+ } from './interface'
8
+
9
+ declare global {
10
+ type CreateVideoContext = CreateVideoContextOrigin
11
+ type Danmu = DanmuOrigin
12
+ type RequestFullScreenOptions = RequestFullScreenOptionsOrigin
13
+ type VideoContext = VideoContextOrigin
14
+ interface Uni extends UniOrigin { }
15
+ }
@@ -0,0 +1,171 @@
1
+ import { ComponentPublicInstance } from 'vue'
2
+
3
+ export type CreateVideoContext = (videoId: VideoIdString, component?: ComponentPublicInstance | null) => VideoContext | null;
4
+
5
+ export type Danmu = {
6
+ /**
7
+ * 弹幕文字
8
+ */
9
+ text: string | null,
10
+ /**
11
+ * 弹幕颜色
12
+ */
13
+ color: string | null,
14
+ /**
15
+ * 显示时刻
16
+ */
17
+ time: number | null
18
+ };
19
+
20
+ export type RequestFullScreenOptions = {
21
+ /**
22
+ * direction
23
+ * - 0: 正常竖向
24
+ * - 90: 屏幕逆时针90度
25
+ * - -90: 屏幕顺时针90度
26
+ * @type 0 | 90 | -90
27
+ */
28
+ direction: number | null
29
+ };
30
+
31
+ export interface VideoContext {
32
+ /**
33
+ * @description 播放
34
+ * @uniPlatform {
35
+ * "app": {
36
+ * "android": {
37
+ * "osVer": "4.4",
38
+ * "uniVer": "√",
39
+ * "unixVer": "3.9.0"
40
+ * }
41
+ * }
42
+ * }
43
+ * @uniVueVersion 2,3
44
+ */
45
+ play(): void;
46
+ /**
47
+ * @description 暂停
48
+ * @uniPlatform {
49
+ * "app": {
50
+ * "android": {
51
+ * "osVer": "4.4",
52
+ * "uniVer": "√",
53
+ * "unixVer": "3.9.0"
54
+ * }
55
+ * }
56
+ * }
57
+ * @uniVueVersion 2,3
58
+ */
59
+ pause(): void;
60
+ /**
61
+ * @description 跳转到指定位置
62
+ * @param {number} position 跳转到指定位置(秒)
63
+ * @uniPlatform {
64
+ * "app": {
65
+ * "android": {
66
+ * "osVer": "4.4",
67
+ * "uniVer": "√",
68
+ * "unixVer": "3.9.0"
69
+ * }
70
+ * }
71
+ * }
72
+ * @uniVueVersion 2,3
73
+ */
74
+ seek(position: number): void;
75
+ /**
76
+ * @description 停止视频
77
+ * @uniPlatform {
78
+ * "app": {
79
+ * "android": {
80
+ * "osVer": "4.4",
81
+ * "uniVer": "√",
82
+ * "unixVer": "3.9.0"
83
+ * }
84
+ * }
85
+ * }
86
+ * @uniVueVersion 2,3
87
+ */
88
+ stop(): void;
89
+ /**
90
+ * @description 发送弹幕
91
+ * @param {Danmu} 属性 text, color
92
+ * @uniPlatform {
93
+ * "app": {
94
+ * "android": {
95
+ * "osVer": "4.4",
96
+ * "uniVer": "√",
97
+ * "unixVer": "3.9.0"
98
+ * }
99
+ * }
100
+ * }
101
+ * @uniVueVersion 2,3
102
+ */
103
+ sendDanmu(danmu: Danmu): void;
104
+ /**
105
+ * @description 设置倍速播放
106
+ * @param {number} rate, 支持倍率 0.5/0.8/1.0/1.25/1.5
107
+ * @uniPlatform {
108
+ * "app": {
109
+ * "android": {
110
+ * "osVer": "4.4",
111
+ * "uniVer": "√",
112
+ * "unixVer": "3.9.0"
113
+ * }
114
+ * }
115
+ * }
116
+ * @uniVueVersion 2,3
117
+ */
118
+ playbackRate(rate: number): void;
119
+ /**
120
+ * @description 进入全屏
121
+ * @param {RequestFullScreenOptions} direction, 0|正常竖向, 90|屏幕逆时针90度, -90|屏幕顺时针90度
122
+ * @uniPlatform {
123
+ * "app": {
124
+ * "android": {
125
+ * "osVer": "4.4",
126
+ * "uniVer": "√",
127
+ * "unixVer": "3.9.0"
128
+ * }
129
+ * }
130
+ * }
131
+ * @uniVueVersion 2,3
132
+ */
133
+ requestFullScreen(direction: RequestFullScreenOptions | null): void;
134
+ /**
135
+ * 退出全屏
136
+ * @description 退出全屏
137
+ * @uniPlatform {
138
+ * "app": {
139
+ * "android": {
140
+ * "osVer": "4.4",
141
+ * "uniVer": "√",
142
+ * "unixVer": "3.9.0"
143
+ * }
144
+ * }
145
+ * }
146
+ * @uniVueVersion 2,3
147
+ */
148
+ exitFullScreen(): void;
149
+ }
150
+
151
+ export interface Uni {
152
+ /**
153
+ * 创建并返回 video 上下文 videoContext 对象
154
+ * @description 创建并返回 video 上下文 videoContext 对象
155
+ * @uniPlatform {
156
+ * "app": {
157
+ * "android": {
158
+ * "osVer": "4.4",
159
+ * "uniVer": "√",
160
+ * "unixVer": "√"
161
+ * }
162
+ * }
163
+ * }
164
+ * @uniVueVersion 2,3
165
+ * @return {VideoContext} 视频对象
166
+ *
167
+ * @tutorial http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext
168
+ *
169
+ */
170
+ createVideoContext(videoId : string | HBuilderX.VideoIdString, component?: ComponentPublicInstance | null) : VideoContext | null
171
+ }