mirror of
https://gitee.com/shuto-github/cordova-plugin-network-information.git
synced 2026-04-22 00:00:02 +08:00
CB-8185 Use navigator.onLine as connection information source on browser platform
* add support for `online`/`offline` events for browser
This commit is contained in:
+3
-1
@@ -26,7 +26,9 @@ var exec = require('cordova/exec'),
|
||||
// Link the onLine property with the Cordova-supplied network info.
|
||||
// This works because we clobber the navigator object with our own
|
||||
// object in bootstrap.js.
|
||||
if (typeof navigator != 'undefined') {
|
||||
// Browser platform do not need to define this property, because
|
||||
// it is already supported by modern browsers
|
||||
if (cordova.platforId !== 'browser' && typeof navigator != 'undefined') {
|
||||
utils.defineGetter(navigator, 'onLine', function() {
|
||||
return this.connection.type != 'none';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user