@tarojs/taro-h5 3.4.1 → 3.4.4
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/dist/api/ai/visual.js +2 -0
- package/dist/api/base/system.js +187 -0
- package/dist/api/canvas/index.js +5 -1
- package/dist/api/device/battery.js +18 -1
- package/dist/api/device/index.js +1 -0
- package/dist/api/{base/system → device}/network.js +29 -14
- package/dist/api/device/wifi.js +1 -0
- package/dist/api/media/EditorContext.js +1 -0
- package/dist/api/network/upload.js +1 -6
- package/dist/api/ui/fonts.js +50 -2
- package/dist/api/utils/handler.js +45 -45
- package/dist/index.cjs.js +359 -141
- package/dist/taroApis.js +1 -1
- package/package.json +6 -6
- package/src/api/ai/visual.ts +3 -0
- package/src/api/base/system.ts +207 -0
- package/src/api/canvas/CanvasContext.ts +6 -6
- package/src/api/canvas/index.ts +10 -2
- package/src/api/device/battery.ts +18 -1
- package/src/api/device/index.ts +1 -0
- package/src/api/{base/system → device}/network.ts +35 -15
- package/src/api/device/wifi.ts +1 -0
- package/src/api/media/EditorContext.ts +2 -0
- package/src/api/network/upload.ts +1 -7
- package/src/api/ui/fonts.ts +61 -2
- package/src/api/utils/handler.ts +4 -4
- package/dist/api/base/system/index.js +0 -2
- package/dist/api/base/system/info.js +0 -57
- package/src/api/base/system/index.ts +0 -2
- package/src/api/base/system/info.ts +0 -64
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import MobileDetect from 'mobile-detect';
|
|
2
|
-
import { MethodHandler } from '../../utils/handler';
|
|
3
|
-
export const getSystemInfoSync = () => {
|
|
4
|
-
const md = new MobileDetect(navigator.userAgent);
|
|
5
|
-
const info = {
|
|
6
|
-
brand: md.mobile() || '',
|
|
7
|
-
model: md.mobile() || '',
|
|
8
|
-
system: md.os(),
|
|
9
|
-
pixelRatio: window.devicePixelRatio,
|
|
10
|
-
screenWidth: window.screen.width,
|
|
11
|
-
screenHeight: window.screen.height,
|
|
12
|
-
windowWidth: document.documentElement.clientWidth,
|
|
13
|
-
windowHeight: document.documentElement.clientHeight,
|
|
14
|
-
version: '',
|
|
15
|
-
statusBarHeight: NaN,
|
|
16
|
-
platform: navigator.platform,
|
|
17
|
-
language: navigator.language,
|
|
18
|
-
fontSizeSetting: NaN,
|
|
19
|
-
SDKVersion: '',
|
|
20
|
-
// TODO
|
|
21
|
-
albumAuthorized: false,
|
|
22
|
-
benchmarkLevel: 0,
|
|
23
|
-
bluetoothEnabled: false,
|
|
24
|
-
cameraAuthorized: false,
|
|
25
|
-
enableDebug: false,
|
|
26
|
-
locationAuthorized: false,
|
|
27
|
-
locationEnabled: false,
|
|
28
|
-
microphoneAuthorized: false,
|
|
29
|
-
notificationAlertAuthorized: false,
|
|
30
|
-
notificationAuthorized: false,
|
|
31
|
-
notificationBadgeAuthorized: false,
|
|
32
|
-
notificationSoundAuthorized: false,
|
|
33
|
-
safeArea: {
|
|
34
|
-
bottom: 0,
|
|
35
|
-
height: 0,
|
|
36
|
-
left: 0,
|
|
37
|
-
right: 0,
|
|
38
|
-
top: 0,
|
|
39
|
-
width: 0
|
|
40
|
-
},
|
|
41
|
-
wifiEnabled: false
|
|
42
|
-
};
|
|
43
|
-
return info;
|
|
44
|
-
};
|
|
45
|
-
export const getSystemInfo = async (options = {}) => {
|
|
46
|
-
const { success, fail, complete } = options;
|
|
47
|
-
const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete });
|
|
48
|
-
try {
|
|
49
|
-
const info = await getSystemInfoSync();
|
|
50
|
-
return handle.success(info);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
return handle.fail({
|
|
54
|
-
errMsg: error
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import Taro from '@tarojs/api'
|
|
2
|
-
import MobileDetect from 'mobile-detect'
|
|
3
|
-
|
|
4
|
-
import { MethodHandler } from '../../utils/handler'
|
|
5
|
-
|
|
6
|
-
export const getSystemInfoSync: typeof Taro.getSystemInfoSync = () => {
|
|
7
|
-
const md = new MobileDetect(navigator.userAgent)
|
|
8
|
-
|
|
9
|
-
const info: ReturnType<typeof Taro.getSystemInfoSync> = {
|
|
10
|
-
brand: md.mobile() || '', // 手机品牌
|
|
11
|
-
model: md.mobile() || '', // 手机型号
|
|
12
|
-
system: md.os(), // 操作系统版本
|
|
13
|
-
pixelRatio: window.devicePixelRatio, // 设备像素比
|
|
14
|
-
screenWidth: window.screen.width, // 屏幕宽度
|
|
15
|
-
screenHeight: window.screen.height, // 屏幕高度
|
|
16
|
-
windowWidth: document.documentElement.clientWidth, // 可使用窗口宽度
|
|
17
|
-
windowHeight: document.documentElement.clientHeight, // 可使用窗口高度
|
|
18
|
-
version: '', // 微信版本号
|
|
19
|
-
statusBarHeight: NaN, // 状态栏的高度
|
|
20
|
-
platform: navigator.platform, // 客户端平台
|
|
21
|
-
language: navigator.language, // 微信设置的语言
|
|
22
|
-
fontSizeSetting: NaN, // 用户字体大小设置。以“我-设置-通用-字体大小”中的设置为准,单位:px
|
|
23
|
-
SDKVersion: '', // 客户端基础库版本
|
|
24
|
-
|
|
25
|
-
// TODO
|
|
26
|
-
albumAuthorized: false,
|
|
27
|
-
benchmarkLevel: 0,
|
|
28
|
-
bluetoothEnabled: false,
|
|
29
|
-
cameraAuthorized: false,
|
|
30
|
-
enableDebug: false,
|
|
31
|
-
locationAuthorized: false,
|
|
32
|
-
locationEnabled: false,
|
|
33
|
-
microphoneAuthorized: false,
|
|
34
|
-
notificationAlertAuthorized: false,
|
|
35
|
-
notificationAuthorized: false,
|
|
36
|
-
notificationBadgeAuthorized: false,
|
|
37
|
-
notificationSoundAuthorized: false,
|
|
38
|
-
safeArea: {
|
|
39
|
-
bottom: 0,
|
|
40
|
-
height: 0,
|
|
41
|
-
left: 0,
|
|
42
|
-
right: 0,
|
|
43
|
-
top: 0,
|
|
44
|
-
width: 0
|
|
45
|
-
},
|
|
46
|
-
wifiEnabled: false
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return info
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const getSystemInfo: typeof Taro.getSystemInfo = async (options = {}) => {
|
|
53
|
-
const { success, fail, complete } = options
|
|
54
|
-
const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete })
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
const info = await getSystemInfoSync()
|
|
58
|
-
return handle.success(info)
|
|
59
|
-
} catch (error) {
|
|
60
|
-
return handle.fail({
|
|
61
|
-
errMsg: error
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
}
|