提交 599af0b5 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -23,6 +23,7 @@
|2g|2g 网络||
|3g|3g 网络||
|4g|4g 网络||
|5g|5g 网络||
|ethernet|有线网络|App|
|unknown|Android 下不常见的网络类型||
|none|无网络| |
......
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.
先完成此消息的编辑!
想要评论请 注册