提交 f15466db 编写于 作者: Q qiang

fix(App): 网络类型支持 5g

上级 6cccdd7f
export const DEVICE_FREQUENCY = 200
export const NETWORK_TYPES = ['unknown', 'none', 'ethernet', 'wifi', '2g', '3g', '4g']
export const NETWORK_TYPES = ['unknown', 'none', 'ethernet', 'wifi', '2g', '3g', '4g', '5g']
export const MAP_ID = '__UNIAPP_MAP'
......
import {
NETWORK_TYPES
} from '../constants'
} from '../constants'
export function getNetworkType () {
return {
errMsg: 'getNetworkType:ok',
networkType: NETWORK_TYPES[plus.networkinfo.getCurrentType()]
networkType: NETWORK_TYPES[plus.networkinfo.getCurrentType()] || 'unknown'
}
}
}
......@@ -86,7 +86,7 @@ function initGlobalListeners () {
})
plus.globalEvent.addEventListener('netchange', () => {
const networkType = NETWORK_TYPES[plus.networkinfo.getCurrentType()]
const networkType = NETWORK_TYPES[plus.networkinfo.getCurrentType()] || 'unknown'
publish('onNetworkStatusChange', {
isConnected: networkType !== 'none',
networkType
......@@ -237,4 +237,4 @@ export function registerApp (appVm) {
__uniConfig.ready = true
process.env.NODE_ENV !== 'production' && perf('registerApp')
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册