Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 3x 1x 3x 2x 1x 1x | /**
* 网络环境检测
* @module env/network
*/
var supportOnline = null;
/**
* 判断页面是否支持联网检测
* @method env/network.support
* @memberof env/network
* @returns {Boolean} 是否支持联网检测
* @example
* var $network = require('@spore-ui/kit/packages/env/network');
* $network.support(); // true/false
*/
function support() {
if (supportOnline === null) {
supportOnline = !!('onLine' in window.navigator);
}
return supportOnline;
}
/**
* 判断页面是否联网
* @method env/network.onLine
* @memberof env/network
* @returns {Boolean} 是否联网
* @example
* var $network = require('@spore-ui/kit/packages/env/network');
* $network.onLine(); // true/false
*/
function onLine() {
return support() ? window.navigator.onLine : true;
}
exports.support = support;
exports.onLine = onLine;
|