network

用于获取当前网络类型的模块

API

status

获取当前连接的网络类型

status(callback)

  • @callback {Function}:执行完该操作后的回调函数。回调函数将收到一个Response对象
    • type {string}:已知的网络类型:none、ethernet、wifi、2g、3g、4g

Demo

const network = weex.requireModule("network");
const modal = weex.requireModule('modal');
network.status(function (res) {
    modal.toast({
	    message: res.type
	})});