@dcloudio/uni-app-x 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +2 -0
- package/index.d.ts +1 -2
- package/package.json +15 -2
- package/types/index.d.ts +4 -0
- package/{native → types/native}/CustomEvent.d.ts +6 -0
- package/types/native/DrawableContext.d.ts +46 -0
- package/{native → types/native}/IPageManager.d.ts +3 -0
- package/types/native/RefresherEvent.d.ts +10 -0
- package/{native → types/native}/ResizeEvent.d.ts +2 -0
- package/types/native/ScrollEvent.d.ts +15 -0
- package/types/native/ScrollToLowerEvent.d.ts +10 -0
- package/types/native/ScrollToUpperEvent.d.ts +10 -0
- package/{native → types/native}/index.d.ts +4 -1
- package/types/uni/base/index.d.ts +3 -0
- package/types/uni/core/index.d.ts +9 -0
- package/types/uni/core/lib/base/event/index.d.ts +15 -0
- package/types/uni/core/lib/base/event/interface.d.ts +40 -0
- package/types/uni/core/lib/interface.d.ts +16 -0
- package/types/uni/core/lib/lifecycle/index.d.ts +9 -0
- package/types/uni/core/lib/lifecycle/interface.d.ts +12 -0
- package/types/uni/core/lib/route/index.d.ts +65 -0
- package/types/uni/core/lib/route/interface.d.ts +208 -0
- package/types/uni/core/lib/ui/create-selector-query/index.d.ts +15 -0
- package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +172 -0
- package/types/uni/core/lib/ui/load-font-face/index.d.ts +25 -0
- package/types/uni/core/lib/ui/load-font-face/interface.d.ts +59 -0
- package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +23 -0
- package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +52 -0
- package/types/uni/core/lib/ui/pull-down-refresh/index.d.ts +25 -0
- package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +52 -0
- package/types/uni/core/lib/ui/set-navigation-bar-color/index.d.ts +23 -0
- package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +56 -0
- package/types/uni/core/lib/ui/tab-bar/index.d.ts +145 -0
- package/types/uni/core/lib/ui/tab-bar/interface.d.ts +442 -0
- package/types/uni/ext/index.d.ts +19 -0
- package/types/uni/ext/lib/uni-audio/utssdk/index.d.ts +13 -0
- package/types/uni/ext/lib/uni-audio/utssdk/interface.d.ts +804 -0
- package/types/uni/ext/lib/uni-exit/utssdk/index.d.ts +19 -0
- package/types/uni/ext/lib/uni-exit/utssdk/interface.d.ts +63 -0
- package/types/uni/ext/lib/uni-file-manager/utssdk/index.d.ts +33 -0
- package/types/uni/ext/lib/uni-file-manager/utssdk/interface.d.ts +132 -0
- package/types/uni/ext/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +9 -0
- package/types/uni/ext/lib/uni-getAccessibilityInfo/utssdk/interface.d.ts +31 -0
- package/types/uni/ext/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +11 -0
- package/types/uni/ext/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +135 -0
- package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/index.d.ts +13 -0
- package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +120 -0
- package/types/uni/ext/lib/uni-getDeviceInfo/utssdk/index.d.ts +13 -0
- package/types/uni/ext/lib/uni-getDeviceInfo/utssdk/interface.d.ts +144 -0
- package/types/uni/ext/lib/uni-getLocation-system/utssdk/index.d.ts +15 -0
- package/types/uni/ext/lib/uni-getLocation-system/utssdk/interface.d.ts +99 -0
- package/types/uni/ext/lib/uni-getLocation-tencent/utssdk/index.d.ts +15 -0
- package/types/uni/ext/lib/uni-getLocation-tencent/utssdk/interface.d.ts +93 -0
- package/types/uni/ext/lib/uni-getNetworkType/utssdk/index.d.ts +23 -0
- package/types/uni/ext/lib/uni-getNetworkType/utssdk/interface.d.ts +67 -0
- package/types/uni/ext/lib/uni-getRecorderManager/utssdk/index.d.ts +13 -0
- package/types/uni/ext/lib/uni-getRecorderManager/utssdk/interface.d.ts +213 -0
- package/types/uni/ext/lib/uni-getSystemInfo/utssdk/index.d.ts +29 -0
- package/types/uni/ext/lib/uni-getSystemInfo/utssdk/interface.d.ts +517 -0
- package/types/uni/ext/lib/uni-getSystemSetting/utssdk/index.d.ts +11 -0
- package/types/uni/ext/lib/uni-getSystemSetting/utssdk/interface.d.ts +61 -0
- package/types/uni/ext/lib/uni-media/utssdk/index.d.ts +93 -0
- package/types/uni/ext/lib/uni-media/utssdk/interface.d.ts +877 -0
- package/types/uni/ext/lib/uni-network/utssdk/index.d.ts +61 -0
- package/types/uni/ext/lib/uni-network/utssdk/interface.d.ts +569 -0
- package/types/uni/ext/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +23 -0
- package/types/uni/ext/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +67 -0
- package/types/uni/ext/lib/uni-prompt/utssdk/index.d.ts +69 -0
- package/types/uni/ext/lib/uni-prompt/utssdk/interface.d.ts +686 -0
- package/types/uni/ext/lib/uni-storage/utssdk/index.d.ts +87 -0
- package/types/uni/ext/lib/uni-storage/utssdk/interface.d.ts +575 -0
- package/types/uni/ext/lib/uni-websocket/utssdk/index.d.ts +49 -0
- package/types/uni/ext/lib/uni-websocket/utssdk/interface.d.ts +511 -0
- package/types/uni/index.d.ts +3 -0
- package/types/uni-cloud/index.d.ts +274 -0
- package/{vue → types/vue}/CheckboxGroupChangeEvent.d.ts +9 -3
- package/types/vue/PickerViewChangeEvent.d.ts +16 -0
- package/types/vue/ProgressActiveendEvent.d.ts +16 -0
- package/types/vue/RadioGroupChangeEvent.d.ts +16 -0
- package/types/vue/SliderChangeEvent.d.ts +16 -0
- package/types/vue/SwitchChangeEvent.d.ts +16 -0
- package/types/vue/index.d.ts +6 -0
- package/vue/index.d.ts +0 -1
- /package/{native → types/native}/Event.d.ts +0 -0
- /package/{native → types/native}/IApp.d.ts +0 -0
- /package/{native → types/native}/IDocument.d.ts +0 -0
- /package/{native → types/native}/INode.d.ts +0 -0
- /package/{native → types/native}/IPage.d.ts +0 -0
- /package/{native → types/native}/ITabsNode.d.ts +0 -0
- /package/{native → types/native}/MouseEvent.d.ts +0 -0
- /package/{native → types/native}/NodeData.d.ts +0 -0
- /package/{native → types/native}/PageEvent.d.ts +0 -0
- /package/{native → types/native}/PageScrollEvent.d.ts +0 -0
- /package/{native → types/native}/TabTapEvent.d.ts +0 -0
- /package/{native → types/native}/TouchEvent.d.ts +0 -0
- /package/{native → types/native}/UniAppManager.d.ts +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 过滤app基本信息,其中filter参数可设置为
|
|
3
|
+
* Android:
|
|
4
|
+
* "brand",
|
|
5
|
+
"deviceBrand",
|
|
6
|
+
"deviceId",
|
|
7
|
+
"model",
|
|
8
|
+
"deviceModel",
|
|
9
|
+
"deviceType",
|
|
10
|
+
"deviceOrientation",
|
|
11
|
+
"devicePixelRatio",
|
|
12
|
+
"system",
|
|
13
|
+
"platform",
|
|
14
|
+
"oaid",
|
|
15
|
+
"isRoot",
|
|
16
|
+
"isSimulator",
|
|
17
|
+
"listeningForADB"
|
|
18
|
+
iOS:
|
|
19
|
+
"brand",
|
|
20
|
+
"deviceBrand",
|
|
21
|
+
"deviceId",
|
|
22
|
+
"model",
|
|
23
|
+
"deviceModel",
|
|
24
|
+
"deviceType",
|
|
25
|
+
"deviceOrientation",
|
|
26
|
+
"devicePixelRatio",
|
|
27
|
+
"system",
|
|
28
|
+
"platform",
|
|
29
|
+
"idfa",
|
|
30
|
+
"isRoot",
|
|
31
|
+
"isSimulator"
|
|
32
|
+
*/
|
|
33
|
+
export type GetDeviceInfoOptions = {
|
|
34
|
+
filter: Array<string>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type GetDeviceInfoResult = {
|
|
38
|
+
/**
|
|
39
|
+
* 设备品牌
|
|
40
|
+
*/
|
|
41
|
+
brand?: string
|
|
42
|
+
/**
|
|
43
|
+
* 设备品牌
|
|
44
|
+
*/
|
|
45
|
+
deviceBrand?: string,
|
|
46
|
+
/**
|
|
47
|
+
* 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
|
|
48
|
+
*/
|
|
49
|
+
deviceId?: string,
|
|
50
|
+
/**
|
|
51
|
+
* 设备型号
|
|
52
|
+
*/
|
|
53
|
+
model?: string,
|
|
54
|
+
/**
|
|
55
|
+
* 设备型号
|
|
56
|
+
*/
|
|
57
|
+
deviceModel?: string,
|
|
58
|
+
/**
|
|
59
|
+
* 设备类型phone、pad、pc
|
|
60
|
+
*/
|
|
61
|
+
deviceType?: string,
|
|
62
|
+
/**
|
|
63
|
+
* 设备方向 竖屏 portrait、横屏 landscape
|
|
64
|
+
*/
|
|
65
|
+
deviceOrientation?: string,
|
|
66
|
+
/**
|
|
67
|
+
* 设备像素比
|
|
68
|
+
*/
|
|
69
|
+
devicePixelRatio?: string,
|
|
70
|
+
/**
|
|
71
|
+
* 操作系统及版本
|
|
72
|
+
*/
|
|
73
|
+
system?: string,
|
|
74
|
+
/**
|
|
75
|
+
* 客户端平台
|
|
76
|
+
*/
|
|
77
|
+
platform?: string,
|
|
78
|
+
/**
|
|
79
|
+
* oaid标识 Android专有
|
|
80
|
+
*/
|
|
81
|
+
oaid?: string,
|
|
82
|
+
/**
|
|
83
|
+
* 是否root
|
|
84
|
+
*/
|
|
85
|
+
isRoot?: boolean,
|
|
86
|
+
/**
|
|
87
|
+
* 是否是模拟器
|
|
88
|
+
*/
|
|
89
|
+
isSimulator?: boolean,
|
|
90
|
+
/**
|
|
91
|
+
* adb是否开启
|
|
92
|
+
*/
|
|
93
|
+
isUSBDebugging?: boolean,
|
|
94
|
+
/**
|
|
95
|
+
* idfa标识 iOS专有
|
|
96
|
+
*/
|
|
97
|
+
idfa?: string,
|
|
98
|
+
/**
|
|
99
|
+
* 应用平台
|
|
100
|
+
*/
|
|
101
|
+
// uniPlatform?:string,
|
|
102
|
+
// osName?:string,
|
|
103
|
+
// osVersion?:string,
|
|
104
|
+
// browserName?:string,
|
|
105
|
+
// browserVersion?:string,
|
|
106
|
+
// osLanguage?:string
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
export type GetDeviceInfo = (config: GetDeviceInfoOptions | null) => GetDeviceInfoResult;
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
export interface Uni {
|
|
115
|
+
/**
|
|
116
|
+
* GetDeviceInfo(Object object)
|
|
117
|
+
* @description
|
|
118
|
+
* 获取设备信息
|
|
119
|
+
* @param {DeviceInfoOptions} options
|
|
120
|
+
* @return {object}
|
|
121
|
+
* @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
|
|
122
|
+
* @uniPlatform {
|
|
123
|
+
* "app": {
|
|
124
|
+
* "android": {
|
|
125
|
+
* "osVer": "4.4",
|
|
126
|
+
* "uniVer": "√",
|
|
127
|
+
* "unixVer": "3.9.0"
|
|
128
|
+
* },
|
|
129
|
+
* "ios": {
|
|
130
|
+
* "osVer": "9.0",
|
|
131
|
+
* "uniVer": "√",
|
|
132
|
+
* "unixVer": "3.9.0"
|
|
133
|
+
* }
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* @example
|
|
137
|
+
```typescript
|
|
138
|
+
uni.getDeviceInfo({
|
|
139
|
+
filter:[]
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
*/
|
|
143
|
+
getDeviceInfo: GetDeviceInfo
|
|
144
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetLocation as GetLocationOrigin,
|
|
3
|
+
GetLocationSuccess as GetLocationSuccessOrigin,
|
|
4
|
+
GetLocationFail as GetLocationFailOrigin,
|
|
5
|
+
GetLocationOptions as GetLocationOptionsOrigin,
|
|
6
|
+
Uni as UniOrigin
|
|
7
|
+
} from './interface'
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
type GetLocation = GetLocationOrigin
|
|
11
|
+
type GetLocationSuccess = GetLocationSuccessOrigin
|
|
12
|
+
type GetLocationFail = GetLocationFailOrigin
|
|
13
|
+
type GetLocationOptions = GetLocationOptionsOrigin
|
|
14
|
+
interface Uni extends UniOrigin { }
|
|
15
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface Uni {
|
|
2
|
+
/**
|
|
3
|
+
* 获取当前的地理位置、速度
|
|
4
|
+
*
|
|
5
|
+
* @tutorial http://uniapp.dcloud.io/api/location/location?id=getlocation
|
|
6
|
+
*/
|
|
7
|
+
getLocation: GetLocation;
|
|
8
|
+
/**
|
|
9
|
+
* 打开地图选择位置。
|
|
10
|
+
*
|
|
11
|
+
* @tutorial http://uniapp.dcloud.io/api/location/location?id=chooselocation
|
|
12
|
+
*/
|
|
13
|
+
//chooseLocation: ChooseLocation;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GetLocation = (options: GetLocationOptions) => void;
|
|
17
|
+
export type GetLocationSuccess = {
|
|
18
|
+
/**
|
|
19
|
+
* 纬度,浮点数,范围为-90~90,负数表示南纬
|
|
20
|
+
*/
|
|
21
|
+
latitude: number,
|
|
22
|
+
/**
|
|
23
|
+
* 经度,范围为-180~180,负数表示西经
|
|
24
|
+
*/
|
|
25
|
+
longitude: number,
|
|
26
|
+
/**
|
|
27
|
+
* 速度,浮点数,单位m/s
|
|
28
|
+
*/
|
|
29
|
+
speed: number,
|
|
30
|
+
/**
|
|
31
|
+
* 位置的精确度
|
|
32
|
+
*/
|
|
33
|
+
accuracy: number,
|
|
34
|
+
/**
|
|
35
|
+
* 高度,单位 m
|
|
36
|
+
*/
|
|
37
|
+
altitude: number,
|
|
38
|
+
/**
|
|
39
|
+
* 垂直精度,单位 m(Android 无法获取,返回 0)
|
|
40
|
+
*/
|
|
41
|
+
verticalAccuracy: number,
|
|
42
|
+
/**
|
|
43
|
+
* 水平精度,单位 m
|
|
44
|
+
*/
|
|
45
|
+
horizontalAccuracy: number,
|
|
46
|
+
/**
|
|
47
|
+
* 地址信息
|
|
48
|
+
*/
|
|
49
|
+
address: any | null
|
|
50
|
+
};
|
|
51
|
+
type GetLocationSuccessCallback = (result: GetLocationSuccess) => void;
|
|
52
|
+
export type GetLocationFail = UniError;
|
|
53
|
+
type UniError = {
|
|
54
|
+
errSubject: string,
|
|
55
|
+
errCode: number,
|
|
56
|
+
errMsg: string,
|
|
57
|
+
data: object | null,
|
|
58
|
+
cause: any | null
|
|
59
|
+
};
|
|
60
|
+
type GetLocationFailCallback = (result: GetLocationFail) => void;
|
|
61
|
+
type GetLocationComplete = any;
|
|
62
|
+
type GetLocationCompleteCallback = (result: GetLocationComplete) => void;
|
|
63
|
+
export type GetLocationOptions = {
|
|
64
|
+
/**
|
|
65
|
+
* 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标
|
|
66
|
+
*/
|
|
67
|
+
type: string | null,
|
|
68
|
+
/**
|
|
69
|
+
* 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
|
|
70
|
+
* @type boolean
|
|
71
|
+
*/
|
|
72
|
+
altitude: boolean | null,
|
|
73
|
+
/**
|
|
74
|
+
* 传入 true 会解析地址
|
|
75
|
+
* @type boolean
|
|
76
|
+
*/
|
|
77
|
+
geocode: boolean | null,
|
|
78
|
+
/**
|
|
79
|
+
* 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果
|
|
80
|
+
*/
|
|
81
|
+
highAccuracyExpireTime: number | null,
|
|
82
|
+
/**
|
|
83
|
+
* 开启高精度定位
|
|
84
|
+
* @type boolean
|
|
85
|
+
*/
|
|
86
|
+
isHighAccuracy: boolean | null,
|
|
87
|
+
/**
|
|
88
|
+
* 接口调用成功的回调函数
|
|
89
|
+
*/
|
|
90
|
+
success: GetLocationSuccessCallback | null,
|
|
91
|
+
/**
|
|
92
|
+
* 接口调用失败的回调函数
|
|
93
|
+
*/
|
|
94
|
+
fail: GetLocationFailCallback | null,
|
|
95
|
+
/**
|
|
96
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
97
|
+
*/
|
|
98
|
+
complete: GetLocationCompleteCallback | null
|
|
99
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetLocation as GetLocationOrigin,
|
|
3
|
+
GetLocationSuccess as GetLocationSuccessOrigin,
|
|
4
|
+
GetLocationFail as GetLocationFailOrigin,
|
|
5
|
+
GetLocationOptions as GetLocationOptionsOrigin,
|
|
6
|
+
Uni as UniOrigin
|
|
7
|
+
} from './interface'
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
type GetLocation = GetLocationOrigin
|
|
11
|
+
type GetLocationSuccess = GetLocationSuccessOrigin
|
|
12
|
+
type GetLocationFail = GetLocationFailOrigin
|
|
13
|
+
type GetLocationOptions = GetLocationOptionsOrigin
|
|
14
|
+
interface Uni extends UniOrigin { }
|
|
15
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface Uni {
|
|
2
|
+
/**
|
|
3
|
+
* 获取当前的地理位置、速度
|
|
4
|
+
*
|
|
5
|
+
* @tutorial http://uniapp.dcloud.io/api/location/location?id=getlocation
|
|
6
|
+
*/
|
|
7
|
+
getLocation: GetLocation;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GetLocation = (options: GetLocationOptions) => void;
|
|
11
|
+
export type GetLocationSuccess = {
|
|
12
|
+
/**
|
|
13
|
+
* 纬度,浮点数,范围为-90~90,负数表示南纬
|
|
14
|
+
*/
|
|
15
|
+
latitude: number,
|
|
16
|
+
/**
|
|
17
|
+
* 经度,范围为-180~180,负数表示西经
|
|
18
|
+
*/
|
|
19
|
+
longitude: number,
|
|
20
|
+
/**
|
|
21
|
+
* 速度,浮点数,单位m/s
|
|
22
|
+
*/
|
|
23
|
+
speed: number,
|
|
24
|
+
/**
|
|
25
|
+
* 位置的精确度
|
|
26
|
+
*/
|
|
27
|
+
accuracy: number,
|
|
28
|
+
/**
|
|
29
|
+
* 高度,单位 m
|
|
30
|
+
*/
|
|
31
|
+
altitude: number,
|
|
32
|
+
/**
|
|
33
|
+
* 垂直精度,单位 m(Android 无法获取,返回 0)
|
|
34
|
+
*/
|
|
35
|
+
verticalAccuracy: number,
|
|
36
|
+
/**
|
|
37
|
+
* 水平精度,单位 m
|
|
38
|
+
*/
|
|
39
|
+
horizontalAccuracy: number,
|
|
40
|
+
/**
|
|
41
|
+
* 地址信息
|
|
42
|
+
*/
|
|
43
|
+
address: any | null
|
|
44
|
+
};
|
|
45
|
+
type GetLocationSuccessCallback = (result: GetLocationSuccess) => void;
|
|
46
|
+
export type GetLocationFail = UniError;
|
|
47
|
+
type UniError = {
|
|
48
|
+
errSubject: string,
|
|
49
|
+
errCode: number,
|
|
50
|
+
errMsg: string,
|
|
51
|
+
data: object | null,
|
|
52
|
+
cause: any | null
|
|
53
|
+
};
|
|
54
|
+
type GetLocationFailCallback = (result: GetLocationFail) => void;
|
|
55
|
+
type GetLocationComplete = any;
|
|
56
|
+
type GetLocationCompleteCallback = (result: GetLocationComplete) => void;
|
|
57
|
+
export type GetLocationOptions = {
|
|
58
|
+
/**
|
|
59
|
+
* 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标
|
|
60
|
+
*/
|
|
61
|
+
type: string | null,
|
|
62
|
+
/**
|
|
63
|
+
* 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
|
|
64
|
+
* @type boolean
|
|
65
|
+
*/
|
|
66
|
+
altitude: boolean | null,
|
|
67
|
+
/**
|
|
68
|
+
* 传入 true 会解析地址
|
|
69
|
+
* @type boolean
|
|
70
|
+
*/
|
|
71
|
+
geocode: boolean | null,
|
|
72
|
+
/**
|
|
73
|
+
* 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果
|
|
74
|
+
*/
|
|
75
|
+
highAccuracyExpireTime: number | null,
|
|
76
|
+
/**
|
|
77
|
+
* 开启高精度定位
|
|
78
|
+
* @type boolean
|
|
79
|
+
*/
|
|
80
|
+
isHighAccuracy: boolean | null,
|
|
81
|
+
/**
|
|
82
|
+
* 接口调用成功的回调函数
|
|
83
|
+
*/
|
|
84
|
+
success: GetLocationSuccessCallback | null,
|
|
85
|
+
/**
|
|
86
|
+
* 接口调用失败的回调函数
|
|
87
|
+
*/
|
|
88
|
+
fail: GetLocationFailCallback | null,
|
|
89
|
+
/**
|
|
90
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
91
|
+
*/
|
|
92
|
+
complete: GetLocationCompleteCallback | null
|
|
93
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetNetworkType as GetNetworkTypeOrigin,
|
|
3
|
+
GetNetworkTypeSuccess as GetNetworkTypeSuccessOrigin,
|
|
4
|
+
GetNetworkTypeSuccessCallback as GetNetworkTypeSuccessCallbackOrigin,
|
|
5
|
+
GetNetworkTypeFail as GetNetworkTypeFailOrigin,
|
|
6
|
+
GetNetworkTypeFailCallback as GetNetworkTypeFailCallbackOrigin,
|
|
7
|
+
GetNetworkTypeComplete as GetNetworkTypeCompleteOrigin,
|
|
8
|
+
GetNetworkTypeCompleteCallback as GetNetworkTypeCompleteCallbackOrigin,
|
|
9
|
+
GetNetworkTypeOptions as GetNetworkTypeOptionsOrigin,
|
|
10
|
+
Uni as UniOrigin
|
|
11
|
+
} from './interface'
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
type GetNetworkType = GetNetworkTypeOrigin
|
|
15
|
+
type GetNetworkTypeSuccess = GetNetworkTypeSuccessOrigin
|
|
16
|
+
type GetNetworkTypeSuccessCallback = GetNetworkTypeSuccessCallbackOrigin
|
|
17
|
+
type GetNetworkTypeFail = GetNetworkTypeFailOrigin
|
|
18
|
+
type GetNetworkTypeFailCallback = GetNetworkTypeFailCallbackOrigin
|
|
19
|
+
type GetNetworkTypeComplete = GetNetworkTypeCompleteOrigin
|
|
20
|
+
type GetNetworkTypeCompleteCallback = GetNetworkTypeCompleteCallbackOrigin
|
|
21
|
+
type GetNetworkTypeOptions = GetNetworkTypeOptionsOrigin
|
|
22
|
+
interface Uni extends UniOrigin { }
|
|
23
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface Uni {
|
|
2
|
+
/**
|
|
3
|
+
* getNetworkType()
|
|
4
|
+
* @description
|
|
5
|
+
* 获取网络类型
|
|
6
|
+
* @param {GetNetworkTypeOptions} options
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @tutorial http://uniapp.dcloud.io/api/system/network?id=getnetworktype
|
|
9
|
+
* @uniPlatform {
|
|
10
|
+
* "app": {
|
|
11
|
+
* "android": {
|
|
12
|
+
* "osVer": "4.4",
|
|
13
|
+
* "uniVer": "√",
|
|
14
|
+
* "unixVer": "3.9.0"
|
|
15
|
+
* },
|
|
16
|
+
* "ios": {
|
|
17
|
+
* "osVer": "9.0",
|
|
18
|
+
* "uniVer": "√",
|
|
19
|
+
* "unixVer": "3.9.0"
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* @example
|
|
24
|
+
```typescript
|
|
25
|
+
uni.getNetworkType({
|
|
26
|
+
success(res){
|
|
27
|
+
console.log(res);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
*/
|
|
32
|
+
getNetworkType: GetNetworkType;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type GetNetworkType = (options: GetNetworkTypeOptions) => void;
|
|
36
|
+
export type GetNetworkTypeSuccess = {
|
|
37
|
+
/**
|
|
38
|
+
* 网络类型
|
|
39
|
+
*/
|
|
40
|
+
networkType: string
|
|
41
|
+
};
|
|
42
|
+
export type GetNetworkTypeSuccessCallback = (result: GetNetworkTypeSuccess) => void;
|
|
43
|
+
export type GetNetworkTypeFail = UniError;
|
|
44
|
+
type UniError = {
|
|
45
|
+
errSubject: string,
|
|
46
|
+
errCode: number,
|
|
47
|
+
errMsg: string,
|
|
48
|
+
data: object | null,
|
|
49
|
+
cause: any | null
|
|
50
|
+
};
|
|
51
|
+
export type GetNetworkTypeFailCallback = (result: GetNetworkTypeFail) => void;
|
|
52
|
+
export type GetNetworkTypeComplete = any;
|
|
53
|
+
export type GetNetworkTypeCompleteCallback = (result: GetNetworkTypeComplete) => void;
|
|
54
|
+
export type GetNetworkTypeOptions = {
|
|
55
|
+
/**
|
|
56
|
+
* 接口调用成功的回调函数
|
|
57
|
+
*/
|
|
58
|
+
success: GetNetworkTypeSuccessCallback | null,
|
|
59
|
+
/**
|
|
60
|
+
* 接口调用失败的回调函数
|
|
61
|
+
*/
|
|
62
|
+
fail: GetNetworkTypeFailCallback | null,
|
|
63
|
+
/**
|
|
64
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
65
|
+
*/
|
|
66
|
+
complete: GetNetworkTypeCompleteCallback | null
|
|
67
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RecorderManagerStartOptions as RecorderManagerStartOptionsOrigin,
|
|
3
|
+
RecordManagerCallback as RecordManagerCallbackOrigin,
|
|
4
|
+
GetRecorderManager as GetRecorderManagerOrigin,
|
|
5
|
+
Uni as UniOrigin
|
|
6
|
+
} from './interface'
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
type RecorderManagerStartOptions = RecorderManagerStartOptionsOrigin
|
|
10
|
+
type RecordManagerCallback = RecordManagerCallbackOrigin
|
|
11
|
+
type GetRecorderManager = GetRecorderManagerOrigin
|
|
12
|
+
interface Uni extends UniOrigin { }
|
|
13
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export type RecorderManagerStartOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* 指定录音的时长,单位 ms ,如果传入了合法的 duration ,在到达指定的 duration 后会自动停止录音,最大值 600000(10 分钟),默认值 60000(1 分钟)
|
|
4
|
+
*/
|
|
5
|
+
duration: (number) | null;
|
|
6
|
+
/**
|
|
7
|
+
* 采样率,有效值 8000/16000/44100
|
|
8
|
+
*/
|
|
9
|
+
sampleRate: (number) | null;
|
|
10
|
+
/**
|
|
11
|
+
* 录音通道数,有效值 1/2
|
|
12
|
+
*/
|
|
13
|
+
numberOfChannels: (number) | null;
|
|
14
|
+
/**
|
|
15
|
+
* 编码码率,有效值见下表格
|
|
16
|
+
*/
|
|
17
|
+
encodeBitRate: (number) | null;
|
|
18
|
+
/**
|
|
19
|
+
* 音频格式,有效值 aac/mp3
|
|
20
|
+
*/
|
|
21
|
+
format: (string) | null;
|
|
22
|
+
/**
|
|
23
|
+
* 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。
|
|
24
|
+
*/
|
|
25
|
+
frameSize: (number) | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type RecordManagerCallback = (result: any) => void
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export interface RecorderManager {
|
|
32
|
+
/**
|
|
33
|
+
* 开始录音
|
|
34
|
+
* @description 开始录音
|
|
35
|
+
* @uniPlatform {
|
|
36
|
+
* "app": {
|
|
37
|
+
* "android": {
|
|
38
|
+
* "osVer": "4.4",
|
|
39
|
+
* "uniVer": "√",
|
|
40
|
+
* "unixVer": "3.9.0"
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* @uniVueVersion 2,3
|
|
45
|
+
*/
|
|
46
|
+
start(options: RecorderManagerStartOptions): void;
|
|
47
|
+
/**
|
|
48
|
+
* 暂停录音
|
|
49
|
+
* @description 暂停录音
|
|
50
|
+
* @uniPlatform {
|
|
51
|
+
* "app": {
|
|
52
|
+
* "android": {
|
|
53
|
+
* "osVer": "4.4",
|
|
54
|
+
* "uniVer": "√",
|
|
55
|
+
* "unixVer": "3.9.0"
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* @uniVueVersion 2,3
|
|
60
|
+
*/
|
|
61
|
+
pause(): void;
|
|
62
|
+
/**
|
|
63
|
+
* 暂停录音
|
|
64
|
+
* @description 暂停录音
|
|
65
|
+
* @uniPlatform {
|
|
66
|
+
* "app": {
|
|
67
|
+
* "android": {
|
|
68
|
+
* "osVer": "4.4",
|
|
69
|
+
* "uniVer": "√",
|
|
70
|
+
* "unixVer": "3.9.0"
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* @uniVueVersion 2,3
|
|
75
|
+
*/
|
|
76
|
+
resume(): void;
|
|
77
|
+
/**
|
|
78
|
+
* 停止录音
|
|
79
|
+
* @description 停止录音
|
|
80
|
+
* @uniPlatform {
|
|
81
|
+
* "app": {
|
|
82
|
+
* "android": {
|
|
83
|
+
* "osVer": "4.4",
|
|
84
|
+
* "uniVer": "√",
|
|
85
|
+
* "unixVer": "3.9.0"
|
|
86
|
+
* }
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* @uniVueVersion 2,3
|
|
90
|
+
*/
|
|
91
|
+
stop(): void;
|
|
92
|
+
/**
|
|
93
|
+
* 录音开始事件
|
|
94
|
+
* @description 录音开始事件
|
|
95
|
+
* @uniPlatform {
|
|
96
|
+
* "app": {
|
|
97
|
+
* "android": {
|
|
98
|
+
* "osVer": "4.4",
|
|
99
|
+
* "uniVer": "√",
|
|
100
|
+
* "unixVer": "3.9.0"
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
* @uniVueVersion 2,3
|
|
105
|
+
*/
|
|
106
|
+
onStart(options: RecordManagerCallback): void;
|
|
107
|
+
/**
|
|
108
|
+
* 录音暂停事件
|
|
109
|
+
* @description 录音暂停事件
|
|
110
|
+
* @uniPlatform {
|
|
111
|
+
* "app": {
|
|
112
|
+
* "android": {
|
|
113
|
+
* "osVer": "4.4",
|
|
114
|
+
* "uniVer": "√",
|
|
115
|
+
* "unixVer": "3.9.0"
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
* @uniVueVersion 2,3
|
|
120
|
+
*/
|
|
121
|
+
onPause(options: RecordManagerCallback): void;
|
|
122
|
+
/**
|
|
123
|
+
* 录音恢复事件
|
|
124
|
+
* @description 录音恢复事件
|
|
125
|
+
* @uniPlatform {
|
|
126
|
+
* "app": {
|
|
127
|
+
* "android": {
|
|
128
|
+
* "osVer": "4.4",
|
|
129
|
+
* "uniVer": "√",
|
|
130
|
+
* "unixVer": "3.9.0"
|
|
131
|
+
* }
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* @uniVueVersion 2,3
|
|
135
|
+
*/
|
|
136
|
+
onResume(options: RecordManagerCallback): void;
|
|
137
|
+
/**
|
|
138
|
+
* 录音停止事件,会回调文件地址
|
|
139
|
+
* @description 录音停止事件,会回调文件地址
|
|
140
|
+
* @uniPlatform {
|
|
141
|
+
* "app": {
|
|
142
|
+
* "android": {
|
|
143
|
+
* "osVer": "4.4",
|
|
144
|
+
* "uniVer": "√",
|
|
145
|
+
* "unixVer": "3.9.0"
|
|
146
|
+
* }
|
|
147
|
+
* }
|
|
148
|
+
* }
|
|
149
|
+
* @uniVueVersion 2,3
|
|
150
|
+
*/
|
|
151
|
+
onStop(options: RecordManagerCallback): void;
|
|
152
|
+
/**
|
|
153
|
+
* 已录制完指定帧大小的文件,会回调录音分片结果数据。如果设置了 frameSize ,则会回调此事件
|
|
154
|
+
* @description 已录制完指定帧大小的文件,会回调录音分片结果数据。如果设置了 frameSize ,则会回调此事件
|
|
155
|
+
* @uniPlatform {
|
|
156
|
+
* "app": {
|
|
157
|
+
* "android": {
|
|
158
|
+
* "osVer": "4.4",
|
|
159
|
+
* "uniVer": "√",
|
|
160
|
+
* "unixVer": "3.9.0"
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
* }
|
|
164
|
+
* @uniVueVersion 2,3
|
|
165
|
+
*/
|
|
166
|
+
onFrameRecorded(options: RecordManagerCallback): void;
|
|
167
|
+
/**
|
|
168
|
+
* 录音错误事件, 会回调错误信息
|
|
169
|
+
* @description 录音错误事件, 会回调错误信息
|
|
170
|
+
* @uniPlatform {
|
|
171
|
+
* "app": {
|
|
172
|
+
* "android": {
|
|
173
|
+
* "osVer": "4.4",
|
|
174
|
+
* "uniVer": "√",
|
|
175
|
+
* "unixVer": "3.9.0"
|
|
176
|
+
* }
|
|
177
|
+
* }
|
|
178
|
+
* }
|
|
179
|
+
* @uniVueVersion 2,3
|
|
180
|
+
*/
|
|
181
|
+
onError(options: RecordManagerCallback): void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export type GetRecorderManager = () => RecorderManager
|
|
185
|
+
|
|
186
|
+
export interface Uni {
|
|
187
|
+
/**
|
|
188
|
+
* 录音管理
|
|
189
|
+
* @description 录音管理
|
|
190
|
+
* @uniPlatform {
|
|
191
|
+
* "app": {
|
|
192
|
+
* "android": {
|
|
193
|
+
* "osVer": "4.4",
|
|
194
|
+
* "uniVer": "√",
|
|
195
|
+
* "unixVer": "3.9.0"
|
|
196
|
+
* }
|
|
197
|
+
* }
|
|
198
|
+
* }
|
|
199
|
+
* @uniVueVersion 2,3
|
|
200
|
+
* @tutorial http://uniapp.dcloud.io/api/media/record-manager?id=getrecordermanager
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* var manager = uni.getRecorderManager()
|
|
204
|
+
* manager.start({
|
|
205
|
+
* format:"mp3"
|
|
206
|
+
* })
|
|
207
|
+
* manager.onStop((e)=>{
|
|
208
|
+
* console.log("录音结束")
|
|
209
|
+
* })
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
getRecorderManager: GetRecorderManager;
|
|
213
|
+
}
|